4 ms·
I might be very wrong in every way but, string parsing and or manipulating and memoiziation... sound like a super strange combo? For the first you know you're a
by jabwd 9mo ago
I might be very wrong in every way but, string parsing and or manipulating and memoiziation... sound like a super strange combo? For the first you know you're already doing expensive allocations, but the 2nd is also not a pattern I really see apart from in JS codebases. Could you provide more context on how this actually bit you in the behind? memoizing strings seems like a complicated and error prone "welp it feels better now" territory in my mind so I'm genuinely curious.
- tyingq 9mo ago> but the 2nd is also not a pattern I really see apart from in JS codebases. If you're referring to "one-line logger calls that trigger expensive serialization", it's also common in java.
- shermantanktop 9mo agoIn Java it can be a bad toString() implementation hiding behind a + used for string assembly. Or another great one: new instances of ObjectMapper created inside a method for a single call and then thrown away.
- shermantanktop 9mo agoTo be clear this is often sloppy code that shouldn’t have been written. But in a legacy codebase this stuff can easily happen.
- MengerSponge 9mo agoA huge chunk of a "legacy codebase" is "sloppy code that shouldn’t have been written" Unless you're inheriting code written by Bill Atkinson or something.