ChristopherSchultz commented on PR #581: URL: https://github.com/apache/tomcat/pull/581#issuecomment-1416015385
There isn't much of a difference between `String.replace` and `String.replaceAll`. They both use regular expressions under the hood. Java's `Pattern` class has a special case for "this search-string doesn't include any metacharacters" (it's a flag called `LITERAL`) and has optimized code-paths for those cases. IMO `replaceAll` is more clear than `replace` because it's absolutely clear that all instances will be replaced in the string. If performance is the primary factor, here, we should use an implementation of string-replacement that does not involve creating `Pattern` and `Matcher` objects and re-encoding the replacement String _every single time_. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org