Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> C++ has built-in regex now and they're pretty damn good too

Sadly, `std::regex` is anything but good (poor performance, lack of Unicode support) and should be generally avoided.



The linter used at my work insists on not using it....


Is there something wrong with the specification that causes poor performance?


The underlying issue is that for the matches the interface relies a lot on heap allocations for the individual matches, leading to a lot of allocations of small regions to copy from the original input. Many other libraries provide a lot more control there.

In benchmarks std::regexp often is a lot slower compared to other implementations, independent from the standard library implementation of choice.

The big upside compared to all others is that it's always available. But if there is a choice alternatives are often better.


It’s ultimately a “won’t break ABI” issue: https://stackoverflow.com/a/70587711




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: