79442402

Date: 2025-02-16 00:05:17
Score: 0.5
Natty:
Report link

Ignore everything everyone else said and use re2j. It uses linear-time automata-based engine, unlike the builtin regex library of Java (and pretty much every other programming language) which uses the horrendously inefficient backtracking engine, which in Java—as if that wasn't bad enough already—is implemented recursively, making its performance 100x worse due to the method call overhead, and another 100x times worse when running in debug mode. There is also no risk of StackOverflowException which very well can happen in Java, due to the aforementioned recursion.

For the interested readers: https://swtch.com/~rsc/regexp/regexp1.html

Reasons:
  • Blacklisted phrase (1): StackOverflow
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Борат Сагдиев