On 02/25/2015 03:04 PM, William Stein wrote: > >> Any other implementation will be just as slow. > > I'm not sure I agree. This eratosthenes function is pure Python code. > It would probably be 100 times faster if rewritten in Cython using > int's or long's. In fact, this is (more or less) the canonical first > example of a function that benefits directly from being compiled > rather than pure Python -- it's the first example on the Pyrex page: > > http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/ > > That you would think "it's the sieve of Eratosthenes, running as fast > as it can. Any other implementation will be just as slow" is in fact > to me a very strong argument for why it *should* have toy in the name. > Since if it did, it's highly unlikely you would think it is "running > as fast as it can". >
Surely we aren't going to start naming things "toy" just because they're written in Python? I tested in Cython and was going to post numbers, but looking back, you only suggested it would be "100 times faster". The speedup is actually better than that (looks sublinear) -- I just don't consider a factor of 100 on a silly algorithm to be a big difference. You still hit a running time of (1/100)*forever pretty quickly. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.