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

Make require('iconv-lite') fast #26

Merged
merged 1 commit into from
May 19, 2013

Conversation

leetreveil
Copy link
Contributor

Requiring iconv-lite is costly due to the library loading the encodings. This fixes that by lazy-loading them.

Before:

node -e "require('node-iconv')"  0.18s user 0.02s system 98% cpu 0.204 total

After:

node -e "require('node-iconv')"  0.07s user 0.01s system 97% cpu 0.081 total

@ashtuchkin
Copy link
Owner

Interesting. I'm wondering what's your use case that you care about 120ms on start?

@leetreveil
Copy link
Contributor Author

My script may or may not need to use the iconv-lite library depending on the input. So for every file that I parse that doesn't need it I get a +120ms delay.

@ashtuchkin
Copy link
Owner

Ok, thank you and thanks for the contribution!

ashtuchkin added a commit that referenced this pull request May 19, 2013
Implement lazy loading of encodings.
@ashtuchkin ashtuchkin merged commit 21f0aa0 into ashtuchkin:master May 19, 2013
@ashtuchkin
Copy link
Owner

Published v0.2.9.

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