-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve encoding performance #81
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
56f7d6a
to
6e37f4c
Compare
@colinsurprenant can you take one more look? I refactored since your LGTM to get even better performance. |
value = value.to_s.gsub(/[^a-zA-Z0-9]/, "") | ||
return value | ||
value.to_s | ||
.gsub(/[^a-zA-Z0-9]/, "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cosmetic: newline might not be necessary here.
LGTM² |
This change-set replaces character-by-character input sanitizers with equivalent gsub expressions, improving performance especially when many fields are referenced.
For example, when used with the TCP Output and simple field values, I was able to achieve the following maximum throughputs on a 16-worker pipeline: