Skip to content

Slightly optimized print#19

Open
WardLordRuby wants to merge 1 commit intojonhoo:mainfrom
WardLordRuby:opt-print
Open

Slightly optimized print#19
WardLordRuby wants to merge 1 commit intojonhoo:mainfrom
WardLordRuby:opt-print

Conversation

@WardLordRuby
Copy link
Copy Markdown

When converting the code to use multiple threads in the live stream it was needed to convert StrVec keys into an owned type, String when receiving chunks processed by threads. Thus making the latter str::from_utf8 mapping from within print, for ordering btree map keys, no longer necessary.

Also by special casing the is_empty condition of the btree map we are able to avoid placing commas depending if there is a next element in the iterator.

This provided a negligible ~0.05s run time improvement on my machine (8c/16t). Though I am not sure if there is a better way to avoid code duplication other than using format_args! that would result in more efficient assembly.

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.

1 participant