kinow commented on issue #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th… URL: https://github.com/apache/commons-lang/pull/443#issuecomment-524592946 @jochenw >@kinow Strongly opposed to accepting this PR: I don't have studied this in detail, but in my oppinion we'd loose thread safety here. Split methods, and similar simple stuff should always be thread safe, unless there is a very good reason. It appears to be that the solution proposed by @YuyuZha0 would be thread-safe, though I haven't really tried much of the code to confirm. From what I understand, the suggestion here is to use a single data structure per thread (see previous comments about a `ThreadLocal`), following the approach used by the JVM's `BigDecimal`. While it seems like it would indeed improve performance, I also feel like opposing the change but from a maintainability point of view. `StringUtils` has well over 5K lines, and the more we keep adding to it, the harder it gets to maintain. And there is the risk of missing some other use case and having issues in multi-threaded environments as you suggested - even though we have the ThreadLocal, I haven't checked other variables used, or if there is any other possibility of other issues.
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
