9 ms·
Not at all. Some of those number are very important: - Set membership check is 19.0 ns, list is 3.85 μs. Knowing what data structure to use for the job is par
by BiteCode_dev 9mo ago
Not at all.
Some of those number are very important:
- Set membership check is 19.0 ns, list is 3.85 μs. Knowing what data structure to use for the job is paramount.
- Write 1KB file is 35.1 μs but 1MB file is only 207 μs. Knowing the implications of I/O trade off is essential.
- sum() 1,000 integers is only 1,900 ns: Knowing to leverage the stdlib makes all the difference compared to manual loop.
Etc.
A few years ago I did a Python rewrite of a big clients code base. They had a massive calculation process that took 6 servers 2 hours.
We got it down to 1 server, 10 minutes, and it was not even the goal of the mission, just the side effect of using Python correctly.
In the end, quadratic behavior is quadratic behavior.
- deleted 9mo ago[deleted]
- fooker 9mo agoList membership check being significantly slower than set membership check is freshman computer science 101.