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

Improve load time for NaCl module #10

Closed
rpwoodbu opened this issue Jan 21, 2014 · 7 comments
Closed

Improve load time for NaCl module #10

rpwoodbu opened this issue Jan 21, 2014 · 7 comments
Assignees

Comments

@rpwoodbu
Copy link
Owner

Since the move to PNaCl, the NaCl module take a long time to load the first time after an update. This is likely due to the module being converted to the local architecture. This delay is a bit off-putting, and could be a major annoyance during periods of rapid iteration. See if there's a way to cut down the load time or hide it. Some ideas:

  • Load the module immediately upon starting the app, rather than waiting for the user to hit connect. This could hide some of the slowness. This implies using a different mechanism to initiate the connection; this new flow may fit in nicely with issue Allow multiple simultaneous sessions #4.
  • See if we can preload the module as soon as the app is installed or updated. I have some recollection of there being a callback for app updates.
  • See if there's a step after linking, like stripping, that could make the module load faster.
@rpwoodbu
Copy link
Owner Author

I tried stripping the binary, but it didn't seem to have any effect. Not having any luck finding docs on how to speed up the load time. May have to resort to a preloading strategy.

@rpwoodbu
Copy link
Owner Author

Here's the API for getting a callback as soon as the app is installed or updated:
http://developer.chrome.com/apps/runtime.html#event-onInstalled

@rpwoodbu
Copy link
Owner Author

rpwoodbu commented Feb 6, 2014

The PNaCl folks said that loading the module in onInstalled() isn't a bad strategy. I do worry about burning cycles for someone who may have the app installed but aren't actively using it, but maybe that's not a huge deal for as infrequently as it'd happen.

@adlr
Copy link

adlr commented Feb 13, 2014

One minor thing that would go a long way is showing progress. I believe there's a progress callback you can use: https://developers.google.com/native-client/dev/devguide/coding/progress-events

@rpwoodbu rpwoodbu self-assigned this Feb 13, 2014
@rpwoodbu
Copy link
Owner Author

Agreed. I had contemplated adding a progress indication of some sort, and am aware of that API. Since you mentioned it, I'll see about adding it next time I'm in the code.

@rpwoodbu
Copy link
Owner Author

Progress bar added in SHA c6ae894. Still to do: Consider preloading the module on update.

@rpwoodbu
Copy link
Owner Author

I've decided against loading the module on update. It goes against my grain to burn CPU for this, since some users may not actively use the app. It also causes the progress bar not to work the way it is currently implemented, and it just isn't worth wiring it all through. I hope that the Chrome folks make this more efficient in the future, and there are ways I can imagine they could.

For now, I think the progress bar softens the blow sufficiently.

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

No branches or pull requests

2 participants