-
Notifications
You must be signed in to change notification settings - Fork 1.6k
optimized template string substitutions a bit #4840
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
Conversation
fb83649 to
e9693db
Compare
|
Anything still to do here? |
|
If #4882 is merged first we don't need the explicit color handling in tests. |
…ion which only processes the string once
…as they perform a lookup
|
I integrated the change from #4941. |
Co-authored-by: Oliver Stöneberg <firewave@users.noreply.github.com>
…licitly calling `toString()`
|
The stream checking logic is not working as intended because the templates are strings and the colors are resolved before the stream is being called. This will lead to non-colored messages on stderr if you only redirect stdout and vice versa. The behavior is still slightly improved though. I have no idea how to address this yet and we are also not checking the color conversion anywhere. The testing can probably needs to be done with some stream redirection and I will not tackle this in this PR. |
At least that is better than colored messages to stderr if you don't redirect stdout. |
The colors and special characters are fixed replacements which will be identical for each message so we can simply replace those once instead of doing it for each message.
We cannot re-use the new logic from
replace()for the other fields as the generation of the map is slower than the repeated scanning of the string.