darkman66 has quit [Read error: Connection reset by peer]
jacob22 has quit [Read error: Connection reset by peer]
jacob22 has joined #pypy
themsay has quit [Ping timeout: 245 seconds]
ambv^ has joined #pypy
xcm has quit [Read error: Connection reset by peer]
xcm has joined #pypy
ambv has quit [Ping timeout: 255 seconds]
themsay has joined #pypy
kostia has joined #pypy
antocuni has joined #pypy
themsay has quit [Ping timeout: 240 seconds]
themsay has joined #pypy
forgottenone has quit [Remote host closed the connection]
forgottenone has joined #pypy
antocuni has quit [Ping timeout: 240 seconds]
kostia has quit [Remote host closed the connection]
slam_V has joined #pypy
slam_V has quit [Client Quit]
slam_V has joined #pypy
slam_V has quit [Ping timeout: 244 seconds]
lordmauve has quit [Ping timeout: 258 seconds]
lordmauve has joined #pypy
Ai9zO5AP has joined #pypy
kostia has joined #pypy
kostia has quit [Ping timeout: 244 seconds]
altendky has joined #pypy
slam_V has joined #pypy
slam_V has quit [Client Quit]
dddddd has joined #pypy
slam_V has joined #pypy
slam_V has quit [Remote host closed the connection]
slam_V has joined #pypy
slam_V has quit [Remote host closed the connection]
lritter has joined #pypy
kostia has joined #pypy
kostia has quit [Ping timeout: 245 seconds]
<Curi0>
SO I'm running a genetic algorithm which takes around 5 minutes on CPython 3. I tried it on PyPy3 and it takes 13 minutes
<Curi0>
The library I'm using (DEAP) uses Numpy is that why ?
marky1991 has joined #pypy
antocuni has joined #pypy
slam_V has joined #pypy
slam_V has quit [Client Quit]
<tos9>
Curi0: Anything's possible, but someone likely needs a full example to be able to tell -- typically they treat those as bugs thankfully (any case that's slower than CPython)
<tos9>
Curi0: But if you stick an example with instructions on how to run it in a repo usually someone can tell you
<tos9>
(And they're pretty amenable even to the example being large, long as you give instructions on how to actually run it)
<Curi0>
well the samples are faster but my code isn't probably because its operating on numpy arrays
Rhy0lite has joined #pypy
<mattip>
Curi0: how much of numpy are you using to store your data?
<Curi0>
mattip, i have my data stored in a numpy array and just iterating over it during the fitness evaluation function
<mattip>
most of DEAP seems like pure python, except the _hypervolume module, which imports numpy
<mattip>
if you are using pypy27, you could try import "_numpypy.multiarray as np" and using that for data storage instead
forgottenone has quit [Quit: Konversation terminated!]
<mattip>
you won't get the additional numpy modules linalg, random, polynomial, ... but the basic ndarray might be compatible enough
<mattip>
np.array(), np.ones, and the np.dtypes should work
<Curi0>
mattip, i'm using pypy3
<mattip>
or you could try avoiding numpy altogether and using lists-of-lists
<Curi0>
im using numpy to transpose the list
<mattip>
ahh, even _hypervolume only uses numpy for tests.
<Curi0>
any way to do that without numpy ?
<mattip>
here's something totally wild, but it will aviod numpy, I don't know if it will be faster
<mattip>
data = memoryview(numpy.array(data).T)
<mattip>
then that data no longer uses c-extensions to iterate, it is just a memoryview
adamholmberg has joined #pypy
<mattip>
as long as you don't need to access data[1,2,3] but rather data[1][2][3] it might work
<mattip>
ahh, no, even data[1,2,3] works ok
<mattip>
someone must have tried this before, so I'm expecting you to say it blows up
kenaan has joined #pypy
<kenaan>
stevie_92 cpyext-gc-cycle 5d1c0b97ef5a /rpython/memory/gc/: Implemented garbage_pypy and improved tests
bbot2 has quit [Quit: buildmaster reconfigured: bot disconnecting]
<mattip>
would you like a PR to cffi to refactor the code to use it?
<arigato>
no, thanks
<arigato>
I don't like the idea of making a test twice longer for no good reason
<arigato>
I'll use another syntax:
<arigato>
py.test.raises(TypeError, "x[0]") =>
<arigato>
py.test.raises(TypeError, lambda: x[0])
<mattip>
ok
<arigato>
personally I don't like the context manager syntax at all
<arigato>
in this situation I mean
<arigato>
you have a test with a line that makes no sense, and you need to remember to look around to see "oh this line is *meant* to raise, not to be working"
marky1991 has joined #pypy
<LarstiQ>
Curi0: did you see what mattip suggested?
dmalcolm has quit [Read error: Connection reset by peer]
<ronan>
arigato: I hate the function syntax, it makes it hard to see what the code is trying to do in the first place
<ronan>
and note that the non-exec version is semi-deprecated as well
<arigato>
I suppose we can argue about the function syntax
<arigato>
in my opinion the clearest is to give the code in a string
<arigato>
it feels like a hack, sure
<arigato>
but it's clear
<ronan>
well, it's not clear, because you lose syntax highlighting
<ronan>
if your only objection to 'with:' is that it takes 2 lines, you can also write it on one line: 'with pytest.raises(TypeError): x[0]'
<arigato>
true
<arigato>
it's not my main objection though, but that's true
dmalcolm has joined #pypy
<ronan>
anyway, arguing about taste is a bit pointless, but the context manager syntax is the one pytest recommends, so it's the one most likely to be forward-compatible
<arigato>
yes, just saying, whenever pytest makes this kind of changes I consider dropping pytest (e.g. for cffi) and instead reimplementing the tiny subset I need
<ronan>
well, the subset is never as tiny as you think
xcm has quit [Remote host closed the connection]
<ronan>
maintaining your own test runner would be a lot more work than updating some syntax once every few years
<arigato>
OK, so 156 lines to fix...
xcm has joined #pypy
<arigato>
and "only" 174 inside pypy
<antocuni>
arigato: plus, using standard tools make it easier for external people to contribute
<arigato>
I think I'll take antocuni's comment to heart and wait until someone contribute the fix, there is no point for me as long as it continues to work
<antocuni>
arigato: my comment was a "re:" to your "let's rewrite a custom subset of pytest"
<ronan>
arigato: I don't mind doing it, if you're OK with me using the standard syntax
<arigato>
I know :-) it's a way of saying "if people want to contribute, maybe they can start by upgrading the tests"
<antocuni>
I'll save this transcript to show at the next sprint when we will be wondering why we fail at attracting new contributors :)
<arigato>
ronan: thanks! no, you're right, one-liner withs are fine
kostia has joined #pypy
<ronan>
arigato: well, I'd rather put them on 2 lines
<arigato>
cffi has at least some tests where I check that all possible nonsense raise
<arigato>
I think it's clearer to have 20 lines that are all variants of "with raises(TypeError): abc[1]"
<arigato>
rather than 40 lines with alternating indentation and nonsense mini-lines
<arigato>
but yes I'm not too tied to a particular syntax outside these cases
dante has quit [Read error: Connection reset by peer]
<ronan>
OK
dante has joined #pypy
<arigato>
I also agree that "with raises(E):\n f(x+5)" is clearer than "raises(E, f, x+5)", but more verbose particularly if we try to ensure that the "x+5" part won't be caught by the "raises"
<arigato>
it's a concern particularly important for some cffi tests because E is often TypeError, and you don't want a TypeError in computing an argument to get eaten as a pass
<nedbat>
arg = x+5; with raises(E): f(arg)
<arigato>
yes, which becomes one more extra line
<arigato>
again, sometimes not a problem, but sometimes breaks nice compact 20-similar-tests-on-20-lines formatting
<arigato>
("a; with b: c" is not valid syntax if it's all in one line)
<ronan>
TBH, "20-similar-tests-on-20-lines formatting" sounds like an antipattern
marky1991 has quit [Remote host closed the connection]
marky1991 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
marky1991_2 has joined #pypy
xcm has quit [Remote host closed the connection]
marky1991 has quit [Ping timeout: 255 seconds]
xcm has joined #pypy
marky1991_2 has quit [Ping timeout: 255 seconds]
<arigato>
I agree with you to some extend, too. there are cases where the tests could be refactored, but nowadays I tend to prefer regular tests with a little bit of repetition instead of larger metaprogramming hacks
antocuni has quit [Ping timeout: 255 seconds]
marky1991_2 has joined #pypy
marky1991_2 has quit [Remote host closed the connection]
<arigato>
e.g. is it really better to have a loop with function arguments coming from some other longish list, or some number of decorators, or somewhere---when you just want to test that the function raises with all these arguments? maybe it is, but maybe not
marky1991_2 has joined #pypy
marky1991_2 has quit [Remote host closed the connection]
marky1991 has joined #pypy
kostia has quit [Ping timeout: 252 seconds]
darkman6_ has quit [Remote host closed the connection]
jcea has quit [Quit: jcea]
<ronan>
arigato: with @pytest.mark.parametrize you get one test for each case, instead of stopping on the first failure, which is really useful
kostia has joined #pypy
kostia has quit [Ping timeout: 244 seconds]
kostia has joined #pypy
kostia has quit [Ping timeout: 240 seconds]
forgottenone has joined #pypy
marky1991_2 has joined #pypy
marky1991 has quit [Ping timeout: 246 seconds]
themsay has quit [Ping timeout: 250 seconds]
kostia has joined #pypy
kostia has quit [Ping timeout: 245 seconds]
kostia has joined #pypy
kostia_ has joined #pypy
kostia has quit [Read error: Connection reset by peer]
forgottenone has quit [Quit: Konversation terminated!]
forgottenone has joined #pypy
kostia_ has quit [Remote host closed the connection]
kostia has joined #pypy
kostia has quit [Remote host closed the connection]
kostia has joined #pypy
Rhy0lite has quit [Quit: Leaving]
kostia has quit [Remote host closed the connection]
kostia has joined #pypy
forgottenone has quit [Ping timeout: 245 seconds]
kostia has quit [Remote host closed the connection]
kostia has joined #pypy
kostia has quit [Ping timeout: 245 seconds]
kostia has joined #pypy
kostia has quit [Ping timeout: 244 seconds]
PileOfDirt has joined #pypy
marky1991 has joined #pypy
marky1991_2 has quit [Ping timeout: 240 seconds]
adamholmberg has quit [Remote host closed the connection]