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

Avoid utf8 encoding binary image files in getHash. #226

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

fqueze
Copy link
Contributor

@fqueze fqueze commented Apr 29, 2024

Here are 2 profiles of building the same website, first without the PR, and then with the PR.

With the PR, getHash takes 3.1% (30.7ms) of the total build time. Without the PR, it took 34% (549ms) of the total time.

The profile without the PR shows 518ms spent in buffer.toString.

Using samply to capture a profile showing the native code, I could see that almost all the time spent in toString is spent in node::StringBytes::Encode.

Profiles were captured using node --cpu-prof node_modules/.bin/eleventy and then loaded in the Firefox Profiler to visualize and share them.

@zachleat zachleat added this to the Eleventy Image v5.0.0 milestone Oct 1, 2024
@zachleat zachleat merged commit 803d902 into 11ty:main Oct 1, 2024
@zachleat
Copy link
Member

zachleat commented Oct 1, 2024

Shipping with Image v5, thank you!

zachleat added a commit that referenced this pull request Oct 1, 2024
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