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

Check if we can use Babel's polyfills #8464

Closed
yurydelendik opened this issue May 31, 2017 · 5 comments
Closed

Check if we can use Babel's polyfills #8464

yurydelendik opened this issue May 31, 2017 · 5 comments
Labels

Comments

@yurydelendik
Copy link
Contributor

yurydelendik commented May 31, 2017

... to remove some of our own polyfills (such as Symbol, Promise and WeakMap)

@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented Jun 9, 2017

I've tried implementing this, WIP patches available here, and then testing with the output from gulp generic. In both IE 11 and 10, the viewer works just fine.
However, in IE 9, the CPU/memory usage goes through the roof and the viewer is no longer is usable :-(

@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented Jun 12, 2017

Since babel-polyfill is (basically) importing the core-js library[1], I've also tried importing only a couple of modules directly from core-js.
In particular, I tried replacing only our Typed Array polyfills with the core-js ones; see https://github.com/zloirock/core-js#ecmascript-6-typed-arrays. Since it'd be really nice to have access to Uint8ClampedArray, so that we could remove the manual clamping used throughout the code-base.

When testing the above in IE9, the viewer did manage to load eventually, but the performance was subjectively worse than with the current master (which is really slow already).
Personally, I'm of the opinion that we cannot allow support for IE9 to dictate improvements to PDF.js core code, so I'd be totally fine with worse performance in IE9 as a side-effect of e.g. using the core-js typed array polyfills.

So, how could/should we proceed here?


[1] See https://github.com/babel/babel/blob/1b29ab12899fa70d63c3c426a05c5b0bcb9260b7/packages/babel-polyfill/src/index.js#L6.

@yurydelendik
Copy link
Contributor Author

but the performance was subjectively worse than with the current master

do you have any numbers for it?

With PDF.js 2.0 we could drop support for typed arrays polyfills (and IE9). I'm glad to hear that PDF.js is usable with core-js polyfills. Shall we just drop it now in favor of core-js ?

@timvandermeij
Copy link
Contributor

timvandermeij commented Jun 12, 2017

I'm personally fine with dropping IE9 support in favor of using the Babel polyfills. More and more problems have come up (and sometimes worked around) to support IE9 while alternatives like IE10 and later are available for a long time. Dropping support will allow us to let core-js manage any polyfilling so we don't have to worry about it anymore; less code, more maintainability and standardization. If a user really wants to support IE9 for some reason, then they can use an older version of PDF.js or modify it for their use case.

Edit: It is also likely that performance of PDF.js will improve; see e.g., #4901.

@timvandermeij
Copy link
Contributor

Closing since this is fixed. Either we eliminated polyfills for browsers that are not supported anymore in PDF.js 2.0 or we used the ones from core-js where possible. If anything else still needs to be done, please open a follow-up ticket for that specific case.

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

3 participants