On Thu, 16 Sep 2021 03:26:39 +1000, Chris Angelico wrote: > On Thu, Sep 16, 2021 at 3:17 AM Mostowski Collapse > <janbu...@fastmail.fm> wrote: >> >> I really wonder why my Python implementation is a factor 40 slower than >> my JavaScript implementation. >> Structurally its the same code. >> >> > Very hard to know. Your code is detailed and complicated. Do they > produce identical results? Are you using the same sort of floating-point > data everywhere, or is one integer and the other float? > What's going on with all the globals, the continuations, etc? My > suspicion is that you're trying to write weird, wonky Python code, and > then are surprised that it doesn't perform well. > > ChrisA
And this demonstrates how an experienced Python programmer can make an almost spot on diagnosis without even checking the source code. @ this stage I would recommend watching some presentations on you tube this one https://www.youtube.com/watch?v=wf-BqAjZb8M by Raymond Hettinger is brilliant as it highlights there is more to checking code than just making sure it looks nice & runs correctly. -- Lemmings don't grow older, they just die. -- https://mail.python.org/mailman/listinfo/python-list