4 ms·
15+ years ago many people would tell you that you should do “from foo import bar” instead of “import foo” to save the overhead inherent in referencing “bar” as
by dfox 2y ago
15+ years ago many people would tell you that you should do “from foo import bar” instead of “import foo” to save the overhead inherent in referencing “bar” as “foo.bar”. Well, as almost everything in Python is in the end an dict, the dict implementation is ridiculously optimized (and in some counter-intuitive ways), so if you care about that overhead you probably should not be using (C)Python in the first place.
This “everything is a dict” is also a part of why removing GIL is not as straightforward as it would seem.
- winrid 2y agoActually even on a modern CPU that property lookup does add another ~10% penalty. Granted it's like a .1 second difference out of a second runtime for 10m iterations, but it's measurable! Although I wouldn't be using python on those data sizes usually :)