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, now unnecessary, asynchronicity in the BasePreferences constructor #12630

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Nov 16, 2020

Originally the default preferences were defined in a JSON-file checked into the repository, which was loaded using SystemJS in development mode.
Over the years a number of changes have been made to this code, most notably:

  • The preferences JSON-file is now generated automatically, during building, from the AppOptions abstraction.
  • All SystemJS usage has been removed from the development viewer.

Hence the default preferences are now available synchronously even in the development viewer, and it's thus no longer necessary to defer to the microtask queue (since getDefaultPreferences is async) just to get the default preferences.

While the effect of these changes is quite small, it does reduces the time it takes for the preferences to be fully initialized. Given the amount of asynchronous code during viewer initialization, every bit of time that we can save should thus help.

Smaller/simpler diff with https://github.com/mozilla/pdf.js/pull/12630/files?w=1

@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/811d270a51575d6/output.txt

…tructor

Originally the default preferences were defined in a JSON-file checked into the repository, which was loaded using SystemJS in development mode.
Over the years a number of changes have been made to this code, most notably:
 - The preferences JSON-file is now generated automatically, during building, from the `AppOptions` abstraction.
 - All SystemJS usage has been removed from the development viewer.

Hence the default preferences are now available *synchronously* even in the development viewer, and it's thus no longer necessary to defer to the microtask queue (since `getDefaultPreferences` is async) just to get the default preferences.

While the effect of these changes is quite small, it *does* reduces the time it takes for the preferences to be fully initialized. Given the amount of asynchronous code during viewer initialization, every bit of time that we can save should thus help.
@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/811d270a51575d6/output.txt

Total script time: 4.05 mins

Published

@timvandermeij timvandermeij merged commit a06f487 into mozilla:master Nov 16, 2020
@timvandermeij
Copy link
Contributor

Nice simplification!

@Snuffleupagus Snuffleupagus deleted the BasePreferences-less-async branch November 17, 2020 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants