Open yeikel opened 2 years ago
Could you please assign it to me? I would attempt it in coming weeks...
Could you please assign it to me? I would attempt it in coming weeks...
I'd missed your comment earlier @sebastiankonieczek ; thank you for your offer to pick this up!
I do have some concerns about the do-no-harm aspect of this recipe; it could be challenging to determine what the "hot" code paths are, and applying this recipe everywhere might not improve memory use or code readability. Perhaps we should limit the recipe applicability in some way initially, for instance only where used in streams or loops? Open to other suggestions.
String
replaceAll
uses a compiled regular expression. In "hot" methods this often leads to performance problems due to the often need to GC.In an internal library, replacing this pattern resulted in a considerable speed-up and I expect the same for many others
This recipe could do "harm" if the method is not "hot" as the compiled expression will take unnecessary memory space. We should warn users about this in the recipe description and let them review the diff manually
Same applies to
replaceFirst