Closed jasongrout closed 4 years ago
Every time I ask about "yield" statements in Cython, I always get the same response: very close, not there yet. It will be very easy for me to fix this, once they are implemented. Until then, it's probably ten times the work...
Ah, okay, thanks for the update. I'm CCing robertwb so that he sees (yet again) another vote for yield statements in Cython. I'm sure they'll come in time.
Well, we're very close, but not there yet ;). Realistically, I'm 90% sure they'll be implemented by the time the summer is out, now that I don't have to spend every waking minute on my thesis.
Replying to @robertwb:
... now that I don't have to spend every waking minute on my thesis.
+1!
I was also going to mention in response to
I'm CCing robertwb so that he sees (yet again) another vote for yield statements in Cython.
that I believe in one-person-one-vote, and I must disclose that I have already voted for this :)
This is now part of #9559.
As mentioned in comment:5, the problem has been fixed, so this ticket can be closed as a duplicate of #9559.
sage: ### try sage
sage: %time gg=list(graphs(7))
CPU times: user 83.6 ms, sys: 15.4 ms, total: 99.1 ms
Wall time: 117 ms
sage: ###
sage: ### now compare with nauty
sage: %timeit hh=graphs.nauty_geng('-q 7')
The slowest run took 11.31 times longer than the fastest. This could mean that an intermediate result is being cached.
1000000 loops, best of 5: 409 ns per loop
sage: ###
sage: ### try a larger example with sage
sage: %time gg=list(graphs(8))
CPU times: user 390 ms, sys: 17.6 ms, total: 407 ms
Wall time: 426 ms
sage: ###
sage: ### now compare with nauty again
sage: %timeit hh=graphs.nauty_geng('-q 8')
The slowest run took 9.17 times longer than the fastest. This could mean that an intermediate result is being cached.
1000000 loops, best of 5: 456 ns per loop
Reviewer: Dave Morris
It's amazing how slow our graph generator is:
Compare this to nauty's C implementation (with approximately the same algorithm)
Notice that the vast majority of the time is spent in some python calls, which presumably could be much, much faster if we instead used the underlying C structure via Cython.
CC: @nathanncohen @rlmill @robertwb
Component: graph theory
Reviewer: Dave Morris
Issue created by migration from https://trac.sagemath.org/ticket/9143