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 extension performance #360

Closed
younesaassila opened this issue Jan 31, 2025 · 2 comments · Fixed by #369
Closed

Improve extension performance #360

younesaassila opened this issue Jan 31, 2025 · 2 comments · Fixed by #369
Assignees
Labels
code Related to code enhancement New feature or request

Comments

@younesaassila
Copy link
Owner

younesaassila commented Jan 31, 2025

Current implementation first create an array of lowercase strings then calls includes on the lowercase channel name. Instead use array.some() so that only strings up to a matching one would be put to lowercase (plus avoids new array allocation) Done

@younesaassila younesaassila added bug Something isn't working code Related to code labels Jan 31, 2025
@younesaassila younesaassila self-assigned this Jan 31, 2025
@younesaassila
Copy link
Owner Author

younesaassila commented Jan 31, 2025

I really should figure out how to measure web extension perf overall

https://github.com/joannechen1223/webext-profiler ?

@younesaassila
Copy link
Owner Author

younesaassila commented Feb 1, 2025

Here are the results using the above-mentioned tool:

┌───────────┬──────────────┬────────────────┬─────────────────────┬────────────────┬──────────────────┬──────────────────────┬────────────────┐
│ (index)   │ taskDuration │ layoutDuration │ recalcStyleDuration │ scriptDuration │ pageLoadDuration │ subResourcesDuration │ jsHeapUsedSize │
├───────────┼──────────────┼────────────────┼─────────────────────┼────────────────┼──────────────────┼──────────────────────┼────────────────┤
│ no ext    │ 2759.3152    │ 84.4202        │ 93.3886             │ 1871.2868      │ 2476.3           │ 1787.64              │ 45.622         │
│ ttvlolpro │ 2789.7096    │ 86.146         │ 95.3156             │ 1887.2536      │ 2786.28          │ 2088.68              │ 46.3255        │
└───────────┴──────────────┴────────────────┴─────────────────────┴────────────────┴──────────────────┴──────────────────────┴────────────────┘

Optimizations necessary for:

  • Sub Resources Duration (ms) (+16.84%) PerformanceNavigationTiming.loadEventEnd — PerformanceNavigationTiming.domContentLoadedEventEnd
  • Page Load Duration (ms) (+12.52%) PerformanceNavigationTiming.loadEventEnd — PerformanceEntry.startTime

Docs: https://joannechen1223.github.io/posts/webext-profiler/

Test was to load https://www.twitch.tv/ (5 iterations)

@younesaassila younesaassila changed the title Minor performance improvement in channel whitelist and sub check functions Improve extension performance Feb 1, 2025
@younesaassila younesaassila added enhancement New feature or request and removed bug Something isn't working labels Feb 7, 2025
@younesaassila younesaassila linked a pull request Feb 9, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code Related to code enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant