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

Look at library size #17

Open
walling opened this issue Nov 18, 2013 · 6 comments
Open

Look at library size #17

walling opened this issue Nov 18, 2013 · 6 comments
Labels

Comments

@walling
Copy link
Owner

walling commented Nov 18, 2013

We could potentially compress the udata better. I've been researching this a bit, and we could shave a good amount of bytes by changing the data layout and save in base-36 (which is fast for JavaScript to decode with parseInt).

I also think it's an issue that the code points are layout in this binary format: yyyyyxxxxxxxxyyyyyyyy. This makes the x=0 section quite big, but many times you'd only use latin1 characters and not characters outside the BMP. A better format would be xxxxxxxxxxxxxyyyyyyyy. This creates more data rows, but you have to decompress less data in average, based on the assumption that normal text only revolves around a few Unicode scripts. Or maybe we should make a split between the way BMP and outside-BMP is stored.

I just need to look at my research files again and write the points of my research down in this issue.

@phadej
Copy link
Collaborator

phadej commented Nov 21, 2013

I really doens't full understand how unorm works, I just did some general code improvements :)

Befofe trying to optimize also for size, we should make the benchmark suite. Than one could be separate first priority issue. Maybe there are already some good input files available somewhere already.

@walling
Copy link
Owner Author

walling commented Jan 7, 2014

True, a benchmark suite would be a nice first step.

@dcousens
Copy link

Still looking to do this?
Just noticed unorm accounts for 15% of my applications build size haha.

@claudiolcastro
Copy link

5 years later.. anyone still interested in take some look at this issue? :)

having some trouble with the package size..

@walling
Copy link
Owner Author

walling commented Jul 25, 2018

@claudiolcastro Unfortunately I haven't got the time to look at this project a lot. If anyone is ready to step up and review/merge PRs, I'm ready to hand out commit access and/or publishing rights on npm. There are many small things that could be done to improve the library.

@hybridvision
Copy link

I was also concerned about the size of this package and since it is only a polyfill for my project, I didn't want all users to have to download it.

The cleanest and easiest solution I found was using Polyfill.io to include it when necessary:

<script crossorigin="anonymous" src="https://polyfill.io/v3/polyfill.min.js?flags=gated&features=String.prototype.normalize"></script>

You can use their URL builder here: https://polyfill.io/v3/url-builder/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants