Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
IDK, just react normally. Are you sure he didn't do .toLower() on both of them beforehand?
If he didn't - just fix the thing and hint him to be more careful next time. -
iiii92194yRefuse to approve the merge until he fixes his shit. Code reviews are exactly for that.
-
Maybe he didn't know such function exists. Languages need to stop spoonfeeding by creating unnecessary functions.
-
@theabbie Because high level languages are inherently slower, it's a question of performance that the STL can do as many things as possible, so the users don't have to write these functions in the language itself.
-
@homo-lorens Functions like Array Flatten, Starts with, ends with etc. are fine in standard library as they are not hard to implement but just tedious. This however and also function Array Shuffle for example are neither hard nor tedious. Internally this would also be converting to lower case and comparing which will not take more than one line.
-
@theabbie In that case the error is that the stl function shouldn't convert and compare. Given how often it's reused, no amount of optimization is too much. It should compare bytes, preferably with SIMD.
-
@homo-lorens It's not some tremendous optimization, high-level should not mean having functions for everything, but having features that make most implementations simpler. These only increase the size of standard library and documentation.
-
@theabbie Yes it is. Copying a string (+allocation) and iterating over it twice vs iterating once comparing 4 characters at a time is a huge optimization.
-
@homo-lorens Maybe this would be a bad example, and we are assuming this is happening in the library. Still, having too many functions isn't the best idea.
-
@theabbie the only thing high level actually objectively means is highly abstract. This implies the inability to use platform and problem specific optimizations, which can be solved with providing platform-optimized STL functions for all problems imaginable.
-
@homo-lorens This optimization is useful when millions of operations are performed. And if millions are being performed, the programmer will have to consider these optimisations anyways.
-
@theabbie I'm fairly confident that considering Java's popularity, this function runs way more than a million times a second, altogether probably costing hours of runtime every year. This is what I mean by frequently reused.
-
Okay, my numbers are all over the place because it's impossible to guess at the worldwide calls to an stl utility, but you get the point.
-
@homo-lorens I meant in a single program. For eg. For sorting a list of 10000 strings using bubble sort. Then, these small optimizations on string comparison add up. If it only happens few times, it won't just destroy the program. But yes, it's always better to have the most efficient implementation.
-
@theabbie But I didn't mean a single program,because the investment of writing it well isn't made per program. It's made once, and the return on that investment is every call to it ever made from any Java program.
Related Rants
-
jsjunkie33Everyone always says the previous developer was crap, sometimes you're right
-
SupressWarnings37My coworker left his Windows 10 system unlocked today. Me: 1. Print screen on desktop 2. Saves the image 3. ...
-
RTRMS12I cannot spell for shit, so my coworker keeps commenting on my pull requests with spelling fixes... Decided t...
How to react to a coworker using equals() instead of equalsIgnoreCase() for checking case insensitive strings?
rant
bad code
unsafe
coworker