If you’re optimizing that hard you should probably sort the data first anyway, but yeah, sometimes it’s absolutely called for. Not that I’ve actually needed that in my professional career, but then again I’ve never worked close enough to metal for it to actually matter.
That said, all of these are implemented as functions, so they’re already costing the function call anyway…
Thief way is actually the best among all of these imo, in terms of readability and efficiency.
Not using thief is professional incompetence unless you’re doing something deeply cursed
Like pair programming.
Fr. People like to reimplement wheels tho
Sometimes you need to minimize function calls in a tight loop, but otherwise yeah
Why would you be using JS in this scenario?
If you’re optimizing that hard you should probably sort the data first anyway, but yeah, sometimes it’s absolutely called for. Not that I’ve actually needed that in my professional career, but then again I’ve never worked close enough to metal for it to actually matter.
That said, all of these are implemented as functions, so they’re already costing the function call anyway…
Sometimes, but practically never. Just be a thief.
They’re setting a variable to a function. Just use the original function. All thief does is obfuscate for literally no gain except character count.
I presumed it to be a standin for just directly using Math.max, since there’s no nice way to show that in a valid code snippet
well it’s called Thief. They’re stealing the function and making it look like they wrote it. hence
max1
.Yeah, that’s my reading as well.
Sounds good to me