3 ms·
Ime 2 orders of magnitude is closer to best case, assuming you have already made reasonable Python-based optimizations. But this problem has two components, fun
by willseth 2y ago
Ime 2 orders of magnitude is closer to best case, assuming you have already made reasonable Python-based optimizations. But this problem has two components, function call overhead and conditionals. Moving the original logic into a compiled extension would eliminate a lot of interpreter overhead for function calls, but it would not eliminate the branchy code. His codegen eliminated both.
- IshKebab 2y agoNah 2 orders of magnitude is very typical when going from Python to a "fast" language like C++ or Rust.
- willseth 2y agoIt's pointless to argue what's "typical" when actual results are incredibly varied and specific to each operation. Also you didn't read the rest of my comment.
- IshKebab 2y agoThey're varied. But 2 orders of magnitude is typical. Sometimes it's 1, sometimes 3. Rarely 0 or 4. I did read the rest of your comment; I was just not responding to that part.