21 ms·
Well in the pypy case, couldn't this just be a toggle? As in, you as the user guarantee that your type annotations are correct and strict, and if it isn't, then
by Ph0X 10y ago
Well in the pypy case, couldn't this just be a toggle? As in, you as the user guarantee that your type annotations are correct and strict, and if it isn't, then pypy will just blow up in your face when type annotations aren't respected.
I think that's a fair trade off, and easily doable. Those who want it and respect it get the speedup, those who don't don't lose anything.
- haimez 10y agoI assure you, it's not that simple. You either check types at runtime (big performance penalty, aka: C Python) or you don't because a compiler (or JIT) did the leg work. If you have to double check types at runtime, you've already lost.
- Ph0X 10y agoBut that's why I say, there should be a pypy flag where you tell it to not double check at run time and that you've made sure your annotation is correct. Now if it isn't correct, you'll probably get a segfault or some nasty error and it'll blow up.