23 ms·
Interesting.. well, I'd think the trig functions would be by far the most expensive part of that program. Is Python really that much slower for control struct
by jbooth 17y ago
Interesting.. well, I'd think the trig functions would be by far the most expensive part of that program. Is Python really that much slower for control structures? That's literally the only other computation there.
- pbiggar 17y agoWell, every instruction in a Python program requires running through the interpreter loop. Then you have to decode, get the opcode arguments, then actually do the operation. For calling C functions from Python, you also have to extract the C types, call the C function, and wrap the result back up. Its not hugely slow, but yeah, it adds up, and its fairly easy to see why it compares poorly to compiled versions.