cfbolz changed the topic of #pypy to: PyPy, the flexible snake (IRC logs: https://botbot.me/freenode/pypy/ ) | use cffi for calling C | the secret reason for us trying to get PyPy users: to test the JIT well enough that we're somewhat confident about it
wleslie has quit [Quit: ~~~ Crash in JIT!]
asmeurer__ has joined #pypy
adamholmberg has quit [Remote host closed the connection]
hotpot33 has quit [Read error: Connection reset by peer]
antocuni has joined #pypy
wleslie has joined #pypy
dpn` has joined #pypy
wleslie has quit [Quit: ~~~ Crash in JIT!]
asmeurer__ has joined #pypy
asmeurer__ has quit [Ping timeout: 260 seconds]
wleslie has joined #pypy
wleslie has quit [Quit: ~~~ Crash in JIT!]
<cfbolz>
mattip: a lot of the problems are like this
antocuni has quit [Ping timeout: 260 seconds]
<thnee>
arigato: Thanks for your response regarding FreeBSD. I definitely don't mind making a pull request. Just not sure what the solution should be. I am generally against hard coding paths like that, I would prefer that it relies on some system way of finding lib paths. That's why my question is which other parts are relevant to look at when debugging this. Unless there is a specific reason to hard code it for
<thnee>
FreeBSD like that, but it seems there is not.
jcea has joined #pypy
asmeurer__ has joined #pypy
<mattip>
cfbolz: yeah, just thinking out loud so when I come back to this I can remember how far I got
<cfbolz>
mattip: sure. Just saying that imo a lot of the 3.6 features are actually implemented and tests fail for somewhat spurious reasons
asmeurer__ has quit [Ping timeout: 265 seconds]
marky1991 has joined #pypy
inhahe__ has quit [Ping timeout: 264 seconds]
<the_rat>
I have a function with a single arg and no side effects that when benchmarked (with timeit, repeat calls with same arg) runs in ~5µs with CPython and ~100ns with PyPy JIT. If I run the same benchmark with @lru_cache I get ~270µs with CPython and ~160ns with PyPy. This might mean that lru_cache effectively slows things down in PyPy. Can someone explain-like-I'm-five what might be a plausible explanation for this?
<cfbolz>
the_rat: what does the function do?
<cfbolz>
the_rat: The cache makes it necessary to do a dictionary lookup every time you call the function. If the function is simple enough it is cheaper to actually do the computation instead of doing the lookup in the dictionary
<the_rat>
cfbolz: the single arg is the root node of a graph, and it does some transformations and topological sorting and returns something a list of objects based on that
adamholmberg has joined #pypy
<the_rat>
If it matters, the arg is effectively the same object
<cfbolz>
the_rat: can you paste the code somewhere? It sounds like this is somewhat complicated. But I agree with Alex_Gaynor that maybe a more specific version of the decorator would improve this
<the_rat>
Unfortunately I cannot share the code, it's tied to some proprietary stuff :( You all gave me very good input, I will try with a simpler caching decorator and with different input sizes
asmeurer has joined #pypy
asmeurer has quit [Ping timeout: 268 seconds]
<the_rat>
Very interesting! So, a simple dict lookup for id(arg) cut runtime for the cached case to be close to the uncached case for a small input size. The difference becomes noticeable for larger inputs. This means PyPy is extremely effective at eliminating most of the bloat overhead and getting the performance close to the raw algorithm performance. Exciting :)
Rhy0lite has joined #pypy
raynold has quit [Quit: Connection closed for inactivity]
<cfbolz>
the_rat: why use id? to make it not keep the argument alive?
<the_rat>
cfbolz: because I don't care about __eq__uality testing, only identity. Probably it would have worked the same because I have no __eq__ but I didn't want to think about it so it's more of a mental shortcut for this benchmark
<cfbolz>
you could try something even more radical, like having a list of the last three results and not using a dict at all
<the_rat>
Oh yes, good idea
marky1991 has quit [Ping timeout: 256 seconds]
antocuni has joined #pypy
<the_rat>
That was a precious suggestion, shaved a few more ns. Thanks a lot.
<cfbolz>
the_rat: cool
marky1991 has joined #pypy
<cfbolz>
Alex_Gaynor: wow, lru_cache is quite impressively heavy
<Alex_Gaynor>
cfbolz: IIRC fijal also fought with it once before
<cfbolz>
right
<cfbolz>
locks, and linked lists, and indeed a lot of allocations
<cfbolz>
make we wonder how useful it is even in CPython]
<LarstiQ>
maybe better for avoiding network requests than small computations
adamholmberg has quit [Remote host closed the connection]
adamholmberg has joined #pypy
adamholm_ has joined #pypy
adamholmberg has quit [Remote host closed the connection]
mattip has quit [Ping timeout: 256 seconds]
sbauman has quit [Quit: Connection closed for inactivity]
asmeurer_ has joined #pypy
asmeurer_ has quit [Ping timeout: 256 seconds]
marky1991 has quit [Remote host closed the connection]
marky1991 has joined #pypy
realitix_ has joined #pypy
marky1991 has quit [Read error: Connection reset by peer]
marky1991 has joined #pypy
realitix has quit [Ping timeout: 260 seconds]
realitix_ is now known as realitix
inhahe__ has joined #pypy
asmeurer_ has joined #pypy
asmeurer_ has quit [Ping timeout: 255 seconds]
tayfun26 has quit [Quit: tayfun26]
ivh has joined #pypy
<ivh>
Hi! I have a general newbie question on cffi (used with cpython3 for now, but cffi docs say to ask here): I simply want to use a handful of existing C-functions, spread over several files, with cffi out-of-line API-mode. When calling ffibuilder.set_source(), do I then need to give the contents of all files as second argument, or put all except the first into the sources=[] kwarg ?
tbodt has joined #pypy
realitix has quit [Quit: realitix]
realitix has joined #pypy
Klowner has quit [Remote host closed the connection]
realitix has quit [Client Quit]
lritter_ has quit [Ping timeout: 248 seconds]
asmeurer__ has joined #pypy
marky1991 has quit [Read error: Connection reset by peer]
marky1991 has joined #pypy
marky1991 has quit [Remote host closed the connection]
marky1991 has joined #pypy
antocuni has quit [Ping timeout: 268 seconds]
nunatak has joined #pypy
marky1991 has quit [Remote host closed the connection]