MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/Python/comments/itzn13/an_update_on_python_4/g5ivr9m
r/Python • u/anyfactor Freelancer. AnyFactor.xyz • Sep 16 '20
389 comments sorted by
View all comments
Show parent comments
-1
How do they perform faster? Surely it's the same method?
8 u/SaltyHashes Sep 16 '20 IIRC it's faster because it doesn't even have to call a method. 1 u/[deleted] Sep 17 '20 Yeah I see now, I'm surprised the JIT compiler can't make the same optimisation for the empty dict() case or with just literals inside. 1 u/[deleted] Sep 17 '20 Unless I'm remembering wrong, CPython doesn't use a JIT compiler, only PyPy does? 4 u/Emile_L Sep 17 '20 When you call dict() or any builtin the interpreter needs to first look up in locals and globals for the symbol which adds a bit of overhead.Not sure if that's the only reason though. 0 u/hillgod Sep 16 '20 I don't know how, though I'd guess something with handling *args and **kwargs.Here's an analysis from Stack overflow: https://stackoverflow.com/questions/5790860/and-vs-list-and-dict-which-is-better
8
IIRC it's faster because it doesn't even have to call a method.
1 u/[deleted] Sep 17 '20 Yeah I see now, I'm surprised the JIT compiler can't make the same optimisation for the empty dict() case or with just literals inside. 1 u/[deleted] Sep 17 '20 Unless I'm remembering wrong, CPython doesn't use a JIT compiler, only PyPy does?
1
Yeah I see now, I'm surprised the JIT compiler can't make the same optimisation for the empty dict() case or with just literals inside.
1 u/[deleted] Sep 17 '20 Unless I'm remembering wrong, CPython doesn't use a JIT compiler, only PyPy does?
Unless I'm remembering wrong, CPython doesn't use a JIT compiler, only PyPy does?
4
When you call dict() or any builtin the interpreter needs to first look up in locals and globals for the symbol which adds a bit of overhead.
Not sure if that's the only reason though.
0
I don't know how, though I'd guess something with handling *args and **kwargs.
Here's an analysis from Stack overflow: https://stackoverflow.com/questions/5790860/and-vs-list-and-dict-which-is-better
-1
u/[deleted] Sep 16 '20
How do they perform faster? Surely it's the same method?