3 ms·
> The issue was using either a dict or a list in a hot loop and changing it to the other sped it up like 1000x. The programmer using the wrong data structure i
by hcarvalhoalves 3y ago
> The issue was using either a dict or a list in a hot loop and changing it to the other sped it up like 1000x.
The programmer using the wrong data structure is not a problem with the language.
- CamperBob2 3y agoIt really is with Python. There are simply too many containers and container-like concepts. Lists, arrays, sets, dicts...
- 0cf8612b2e1e 3y agoWhat modern language doesn’t have those? Go kind of cheats and has maps play double duty as sets.
- bongodongobob 3y agoKinda. I guess my native tongue is C/C++ and I wouldn't expect such a huge performance difference when using an array vs a linked list or something. It's not like I had millions of items in that structure either, it was like 100. I think it contained the batch training data from each round. I tried to find the project but couldn't. I was just shocked that there was such a huge difference between primitive data structures. In that situation, I wouldn't have guessed it would make a difference.