Skip to content
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

Reduce the number of host calls when logging #279

Merged
merged 4 commits into from
Mar 14, 2023

Conversation

jeffcharles
Copy link
Collaborator

While investigating something related to failures when calling console.error, I noticed our current implementation is making more host calls than necessary when writing logs. Each call to write on stream will invoke a host call since writes to the stderr stream are not buffered.

This change ensures we only make one one host call when invoking console.error which should improve runtime performance.

@saulecabrera
Copy link
Member

which should improve runtime performance.

I think we should run some benchmarks as part of this change to have a concrete idea of the improvements that we're referring to here.

Copy link
Contributor

@jianghong jianghong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find

@jeffcharles
Copy link
Collaborator Author

Added a benchmark, I'm seeing a 9% to 17% improvement for 100 console.error calls with multiple arguments

@jeffcharles jeffcharles merged commit 0d02b87 into main Mar 14, 2023
@jeffcharles jeffcharles deleted the jc.reduce-hostcall-invocations branch March 14, 2023 13:12
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.

3 participants