3 ms·
Python factorial on big integer is natively as fast as a good C++ implementation of factorial. So clearly the interpreter supports using fast underlying impleme
by Aardwolf 3y ago
Python factorial on big integer is natively as fast as a good C++ implementation of factorial. So clearly the interpreter supports using fast underlying implementations of things
Any idea why python str.find is 100x-1000x slower? Seems like something the interpreter should also hand to an underlying implementation, which could not be that slow.
- ashvardanian 3y agoYes, I have an idea, cause I’ve implemented it :) This simulates substring search as if it was implemented in Python. In reality the Python str calls LibC function from cstring.h, that would work at 1.5GB/s. Still 10x slower than what the simple heuristic provides :)
- Aardwolf 3y agoOh good, the way it was compared with C++ std::string::find made it seem like a direct cross language std lib comparison. Also initially I misread the unit (MB vs GB) and thought python was 10x faster than C++ instead of 100x slower :)