arigato changed the topic of #pypy to: PyPy, the flexible snake (IRC logs: https://quodlibet.duckdns.org/irc/pypy/latest.log.html#irc-end ) | use cffi for calling C | mac OS and Fedora are not Windows
jcea has joined #pypy
tazle has quit [Ping timeout: 246 seconds]
tazle has joined #pypy
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
jcea has quit [Quit: jcea]
adamholmberg has joined #pypy
adamholmberg has quit [Ping timeout: 272 seconds]
tim has joined #pypy
tim has quit [Remote host closed the connection]
tim has joined #pypy
tim has quit [Remote host closed the connection]
tim has joined #pypy
tim has quit [Remote host closed the connection]
tim has joined #pypy
tim has quit [Remote host closed the connection]
tim has joined #pypy
tim has quit [Remote host closed the connection]
tim has joined #pypy
tim has quit [Remote host closed the connection]
tim has joined #pypy
tim has quit [Remote host closed the connection]
tim has joined #pypy
tim has quit [Remote host closed the connection]
tim has joined #pypy
tim has quit [Remote host closed the connection]
tim has joined #pypy
dddddd has quit [Remote host closed the connection]
tim has quit [Remote host closed the connection]
tim has joined #pypy
tim has quit [Remote host closed the connection]
tim has joined #pypy
tim has quit [Remote host closed the connection]
tim has joined #pypy
tim has quit [Remote host closed the connection]
tim has joined #pypy
tim has quit [Remote host closed the connection]
tim has joined #pypy
tim has quit [Remote host closed the connection]
tim has joined #pypy
tim has quit [Remote host closed the connection]
tim has joined #pypy
IRC-Source_5912 has joined #pypy
tim has quit []
tim has joined #pypy
tim has quit [Client Quit]
IRC-Source_5912 has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
IRC-Source_5912 has joined #pypy
IRC-Source_5912 has quit [Client Quit]
IRC-Source_5912 has joined #pypy
IRC-Source_5912 has quit [Client Quit]
Remi_M has quit [Ping timeout: 246 seconds]
IRC-Source_5912 has joined #pypy
Remi_M has joined #pypy
IRC-Source_5912 has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
IRC-Source_5912 has joined #pypy
_whitelogger_ has joined #pypy
_whitelogger has quit [Ping timeout: 250 seconds]
IRC-Source_5912 has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
IRC-Source_5912 has joined #pypy
IRC-Source_5912 has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
amaury has joined #pypy
amaury is now known as Guest75414
Guest75414 has quit [Ping timeout: 268 seconds]
irclogs_io_bot has quit [Remote host closed the connection]
irclogs_io_bot has joined #pypy
Zaab1t has joined #pypy
dddddd has joined #pypy
Zaab1t has quit [Quit: bye bye friends]
lritter has joined #pypy
dddddd has quit [Remote host closed the connection]
antocuni has joined #pypy
<mattip> default own tests take 50 min, py3.5 take 2hrs22min, unicode-utf8-py3 take over 4 hrs (with two timeout tests)
<mattip> that doesn't seem right
<cfbolz> ouch
<mattip> I wonder what is going wrong. I would have expected it to be no slower than py3.5
<antocuni> mattip: how are the benchmarks on speed.pypy.org? Anything suspicious?
<mattip> they have not been running for quite a while now
<cfbolz> the machine went away
<antocuni> oh
<bbot2> Started: http://buildbot.pypy.org/builders/pypy-c-jit-linux-x86-64/builds/5907 [mattip: force build, unicode-utf8-py3]
<mattip> let's see how long app tests take
<cfbolz> mattip: we should take one test file where the difference is really noticable and profile
<cfbolz> maybe there is something obvious
<mattip> profiling is difficult because all the code is compiled, so cprofile shows all the time
<mattip> in py.test.compile
<bbot2> Failure: http://buildbot.pypy.org/builders/pypy-c-jit-linux-x86-64/builds/5907 [mattip: force build, unicode-utf8-py3]
<cfbolz> mattip: OK, but if we have one file that shows the problem we can run it differently
<cfbolz> Also, we could try to run with --assert=none, or whatever the option is called
* mattip trying with pytest-profiling
<mattip> python2 pytest.py --profile pypy/module/_cffi_backend/test/test_recompiler.py -k test_math_sin
<antocuni> cfbolz: I added a paragraph to the blog post with your suggestions, if you want to look at it (249ded615a14)
<antocuni> and 2d7750cef08d contains more tweaks
<antocuni> if anybody wants can do a last-minute review; I'd like to post it later today
<mattip> antocuni: nice post
<cfbolz> antocuni: yes, sounds good
<antocuni> cool, thanks
<mattip> if anyone wants to take a look, the two profile files are on dropbox
<mattip> pip install pyprof2calltree; pyprof2calltree -k -i <file> shows the profiling in kcachegrind
<mattip> but it seems like just everything is slower
Rhy0lite has joined #pypy
marky1991 has joined #pypy
<mattip> _pure_lookup_where_with_method_cache is called 200,000 times instead of 116,000 times, and self time is 3.6 instead of 1.46
<mattip> which makes it go from 2% of the total to 25%
<mattip> same with _hash_string, which is called by _pure_lookup_where_with_method_cache: more calls, much slower
<antocuni> blogger is really bad, we should find a better way to write blog posts :(
dddddd has joined #pypy
<mattip> yes, we should move to github for the better workflow, and use github pages
<mattip> we would lose the comment feature, but really everyone comments on reddit anyway
<mattip> unfortunately we would have to move to git
<antocuni> well, we could have a git repo for only the blog posts
<antocuni> and we can probably use some 3rd party service for comments
<simpson> antocuni: Nice!
<hruske> nice work with the low latency
<antocuni> thanks
<LarstiQ> like disqus or such for the comments
<hruske> I see that the speed.pypy.org benchmarks aren't run anymore, where did the machine go?
<mattip> hruske: The benchmark runner died, the website is still up but not recieving updates
<hruske> yeah, that seems quite a bummer
<mattip> know of anyone with a modern bare metal machine they want to donate to the cause?
<hruske> should this include the hosting or just the hardware?
<mattip> hosting would be ideal
<mattip> we need something that will be around for a while, so the benchmarks are stable
<tos9> antocuni: nice!
* tos9 wonders whether that's a big deal for $WORK or not
<tos9> I suspect maybe it'd be nice to see if we can get the gc to run only when not in the middle of processing an HTTP request
<antocuni> tos9: it depends how bad it is to have a pause
<tos9> antocuni: yeah... it's hard for me to guess that actually :)
<bbot2> Started: http://buildbot.pypy.org/builders/pypy-c-jit-linux-x86-64/builds/5908 [mattip: force build, unicode-utf8-py3]
marky1991 has quit [Remote host closed the connection]
marky1991 has joined #pypy
Zaab1t has joined #pypy
marky1991 has quit [Remote host closed the connection]
marky1991 has joined #pypy
<bbot2> Failure: http://buildbot.pypy.org/builders/pypy-c-jit-linux-x86-64/builds/5908 [mattip: force build, unicode-utf8-py3]
irclogs_io_bot has quit [Ping timeout: 252 seconds]
irclogs_io_bot has joined #pypy
xcm is now known as Guest81762
Guest81762 has quit [Killed (asimov.freenode.net (Nickname regained by services))]
xcm has joined #pypy
marky1991 has quit [Ping timeout: 272 seconds]
<tos9> cfbolz: the u-bahn from dusseldorf center seems reasonably sane right :)? looks like a 25 minute ride-ish?
<tos9> (if I choose to stay there, which I probably will)
Zaabtop has joined #pypy
Zaab1t has quit [Ping timeout: 272 seconds]
Zaabtop is now known as Zaab1t
<cfbolz> Yep, it is
irclogs_io_bot has quit [Remote host closed the connection]
<tos9> Cool.
<catern> think I'm missing something obvious... in cffi, if I have a regular python bytes object, and I want to cast it into a cffi pointer to a struct, and have that pointer to a struct outlive the bytes object, what's the idiomatic way to do it?
<catern> ffi.cast(ffi.from_buffer(data)) turns to garbage as soon as data goes out of scope
<fijal> catern: *generally* it's your responsibility to keep data alive in this case
<fijal> since from_buffer does not give you somehting with a handle (you have no idea how long will this stuff live in C)
<catern> sure, but data is just a Python bytes object, I can't keep it alive without pointlessly passing it around along with the casted pointer
<catern> I can't get a CFFI pointer that has a reference to the underlying Python bytes and keeps them alive?
<catern> the docs for from_buffer state that it does keep the original object alive
<catern> but I assume the issue is that the cast stops that
<fijal> you need to make a copy
<fijal> and there is also ffi.gc
<fijal> but that's the other way around
<fijal> catern: but also remember - you're storing it in a struct
<fijal> there is no way to know how long struct is alive and by which mechanism it is freed
<fijal> so where would you store the extra pointer? it can't be stored in that struct
<fijal> it can be stored in a magic struct pointer, but we decided against such level of magic
<catern> hm? I'm only casting these bytes to a struct so I can read the fields from Python
<catern> the python cffi object certainly isn't just a struct pointer, it also has additional pointers and references to things
<catern> unless you're saying the char[] returned by from_buffer is magical, in that it has the magic ability to keep another python object alive, and all other cffi pointers don't have that ability?
<catern> not sure what you mean by "know how long struct is alive and by which mechanism it is freed" - there's no C code involved here for now, it's purely garbage collected
<catern> in python
irclogs_io_bot has joined #pypy
antocuni has quit [Ping timeout: 246 seconds]
<fijal> then why are you using cffi?
<fijal> cffi struct is not magic - it's really a bunch of C pointers
<fijal> but the cffi python object does keep the struct alive (as does char[] one)
<fijal> but it does not keep extra python objects alive, like the fields referenced there
<catern> well, I'm using cffi for other thingsin this program, and now I want to turn some bytes into a struct by casting them (I could alternatively reimplement a bunch of parsing logic but that seems like a waste), so that's why I am using cffi in this one specific instance even though there's no C involved
<catern> in this case
<catern> I see, you're saying that if I have a struct foo { void *bar; } and bar points to a python object, a cffi object pointing to a "struct foo*" won't keep the bar object alive?
<catern> but that's not the situation I'm in
<catern> I've just got struct quux { int a; int b; int c; }, and a python bytes object that's formatted that way, and I want to read the latter as the former
_whitelogger has joined #pypy
Zaab1t has quit [Quit: bye bye friends]
Rhy0lite has quit [Quit: Leaving]
demonimin has joined #pypy
amaury has joined #pypy
amaury is now known as Guest90598
Ai9zO5AP has quit [Quit: WeeChat 2.3]
<_aegis_> cool gc post, I assume there's nothing I can do about calling a pypy function from C during a GC pause though
<atomizer> catern: the result of ffi.cast is a reference, if the object dies it points to garbage
<atomizer> i'd suggest casting at every consumer site instead of casting once and keeping bytes alive on the side
<atomizer> casting is nearly no-op anyway
Guest90598 has quit [Ping timeout: 246 seconds]
lritter has quit [Ping timeout: 244 seconds]
<dddddd> Small coverage (just a notice) of Cuni's recent article, at LWN https://lwn.net/Articles/775916/
<mattip> grr. NumPy started assigning to func.__module__, which we do not support
<mattip> here is the python documentatation for callables