3 ms·
I was waiting for that. The history of micro-optimization is replete with myths and legends which sound juuuuuuust plausible enough to be true (or were true a
by patio11 17y ago
I was waiting for that. The history of micro-optimization is replete with myths and legends which sound juuuuuuust plausible enough to be true (or were true a decade ago) and endure to this day.
I'm currently involved in a project at work which requires translating a (Java) coding standards document. I have filed probably two dozen bugs against the document that sound like "The rationale for standard 2.4.3 is translated correctly from the Japanese but contrary to technical fact." They include my personal favorite Java performance tip "Don't use the nice readable str + str syntax to concatenate, instead, use StringBuilder."
- tdavis 17y agoI don't know if it is really indicative of anything, but I remember micro-optimization being a rather prevalent topic during my PHP days. Perhaps it was just the folks I was reading, I don't know. The only thing worse than an article about micro-optimization is one that is both out of date and almost entirely backwards.
- ReturnTheGift 17y ago"Don't use the nice readable str + str syntax to concatenate, instead, use StringBuilder" Depending on who the audience is for your coding standards, this may not be a bad standard to have. In certain scenarios (e.g. building a very large String in a loop), appending with a StringBuilder can be vastly more efficient than "str+=" concatenation. Without the standard, the audience needs to know when it's not appropriate to use "str+=" concatentation.