3 ms·
One major point of OP was that the functions defined in operators are faster. Grandparent comment argued that there is a measurement error that invalidates this
by sharikous 5y ago
One major point of OP was that the functions defined in operators are faster. Grandparent comment argued that there is a measurement error that invalidates this point, since properly defined lambdas (or defs) are just as fast.
Of course the point regarding the simplicity of importing a function instead of defining it still stands.
I personally wouldn't mind defining those functions as they are very immediate. So from the article I would take only the part about the more exotic "operator".
- klyrs 5y agoThe timings are certainly closer, but the built-in function imported from operator is still faster than the user-defined function. Not a big deal if you're doing simple stuff, but if this code is in a hot loop that 30% can make a measurable difference.