3 ms·
I know hasty optimisation is the root of all evil, but even so this has got to be a bit too far in the other direction. A 2x speed improvement is very signific
by shiandow 3y ago
I know hasty optimisation is the root of all evil, but even so this has got to be a bit too far in the other direction.
A 2x speed improvement is very significant if it happens to be in the critical loop of your code. You want a 5000% difference? Just find 6 tweaks like these and you might just get there.
Of course in most cases whatever you're doing to build the dict is more likely taking up most of the time, not building the dict itself, but understanding why one option is 2x as fast is still important. Though one can only hope that it will soon be irrelevant when JITed python becomes a thing.
- pi-e-sigma 3y ago> A 2x speed improvement is very significant if it happens to be in the critical loop of your code. You want a 5000% difference? Just find 6 tweaks like these and you might just get there. Optimizations don't compound like this.