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

Performance Audit 2017: Beacon: ResourceTiming Compression #174

Open
nicjansma opened this Issue Dec 22, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@nicjansma

nicjansma commented Dec 22, 2017

ResourceTiming is currently the most expensive plugin as far as JavaScript CPU time and beacon size for larger sites.

image

Depending on the site and device, compressing the ResourceTiming entries could take 20-100 milliseconds or more.

We should investigate ways of reducing this cost. Some ideas:

  • Before compressing the entries, we must iterate over all of the frames in the page to gather all entries. We could use the PerformanceObserver in some (or all) frames to get notified of new entries, instead of crawling for them
  • The optimizeTrie is the most expensive operation, where it iterates over each character in every URL. We could look into forming a non-perfect Trie by grouping every 10 characters together, or something
@bluesmoon

This comment has been minimized.

Show comment
Hide comment
@bluesmoon

bluesmoon Dec 22, 2017

For optimizeTrie, we could also just split on [./?&=] and use those as groups. Also, reversing the hostname should be built in.

We should also see if we can move the optimization over to a WebWorker and use postMessage to send the resulting string back to the main thread.

bluesmoon commented Dec 22, 2017

For optimizeTrie, we could also just split on [./?&=] and use those as groups. Also, reversing the hostname should be built in.

We should also see if we can move the optimization over to a WebWorker and use postMessage to send the resulting string back to the main thread.

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