[ prog / sol / mona ]

prog


LISP Puzzles

140 2020-05-25 14:58

>>139

Attribute lookup is so slow in CPython that it is faster to let the same mpz constants be converted anew from python ints on every invocation.

This seems pretty crazy.

This idea was also expressed by >>33 and is used in the OEIS C version >>42.

In that case, thank you also to >>33, and >>42. I probably should have understood this earlier since I am completely certain I read >>33 already, and I have no reason to have not read >>42 other than a superior implementation having been made by that point in the thread. On a related note I think that the higher-order implementation is simply beyond my skills, (even with the reference implementation) while I wanted to validate your values for k greater than 17 and provide you with a benchmark for your Cpython comparison (the latter of which seems less relevant now with your recent observations), I'll have to leave this to someone else. Best of luck to everyone those who are going to continue to play!

157


VIP:

do not edit these