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

Open
younesaassila opened this issue Jan 31, 2025 · 2 comments
Open

Improve extension performance #360

younesaassila opened this issue Jan 31, 2025 · 2 comments
Assignees
Labels
bug Something isn't working code Related to code

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 added a commit that referenced this issue Feb 1, 2025
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working code Related to code
Projects
None yet
Development

No branches or pull requests

1 participant