3 ms·
It may be a shorter number of bytecodes, but that does not mean it has better performance. You have two function calls in the range version and only one in the
by daveguy 11y ago
It may be a shorter number of bytecodes, but that does not mean it has better performance.
You have two function calls in the range version and only one in the non-range version. You are just hiding some of that code in a dynamic function call. Also, your compare_op consists of two <= in the non-range version and an "in" compare_op for the range version (which probably hides the element by element comparison or hash/bloom if it is O(1).
Fewer lines of code does not mean more efficient. Regardless of whether it is source code or bytecode.
- maxerickson 11y agoThere's no argument made in the comment you replied to. Certainly not a strident one in favor of range. It appears to me they went ahead and posted the bytecode for both because they had spun up an interpreter to get the bytecode for one.