Skip to content

Conversation

@byroot
Copy link
Contributor

@byroot byroot commented Jan 15, 2026

With the introduction of Regexp.timeout, which is set to 1s by default in Rails 8.0, we ran into the control char stripping gsub sometimes timing out.

This can be done much more efficiently with String#tr_s, it's about 3x faster and has guaranteed linear performance.

With the introduction of `Regexp.timeout`, which is set to 1s by
default in Rails 8.0, we ran into the control char stripping `gsub`
sometimes timing out.

This can be done much more efficiently with `String#tr_s`, it's about
3x faster and has guaranteed linear performance.
@byroot byroot force-pushed the optimize-control-char-stripping branch from 1ff72ce to 6901292 Compare January 15, 2026 11:04
@eugeneius eugeneius merged commit bbd8efb into cypriss:master Jan 15, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants