nolanlawson / emoji-picker-element

A lightweight emoji picker for the modern web
https://nolanlawson.github.io/emoji-picker-element/
Apache License 2.0
1.27k stars 80 forks source link

fix: cancel inflight requests if database is canceled #410

Closed nolanlawson closed 3 months ago

nolanlawson commented 4 months ago

If database.close() is called, we should cancel any inflight IDB/fetch operations. This should eventually allow us to start setting up the database sooner than a microtask, since we can cancel the request if the user decides to change the data source.

github-actions[bot] commented 4 months ago

📊 Tachometer Benchmark Results

Summary

benchmark-total

  • emoji-picker-element-change-tab: unsure 🔍 -1% - +1% (-0.17ms - +0.21ms)
    this-change vs tip-of-tree
  • emoji-picker-element-database-interactions: unsure 🔍 -7% - +4% (-6.87ms - +3.79ms)
    this-change vs tip-of-tree
  • emoji-picker-element-first-load: unsure 🔍 -5% - +4% (-2.38ms - +1.92ms)
    this-change vs tip-of-tree
  • emoji-picker-element-second-load: unsure 🔍 -7% - +4% (-2.80ms - +1.40ms)
    this-change vs tip-of-tree

Results

emoji-picker-element-change-tab
  • Browser: chrome-headless 122.0.6261.111
  • Sample size: 50
  • Built by: Benchmarks #406
  • Commit: 8062511
VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
this-change
33.33ms - 33.63ms-unsure 🔍
-1% - +1%
-0.17ms - +0.21ms
tip-of-tree
tip-of-tree
33.35ms - 33.58msunsure 🔍
-1% - +1%
-0.21ms - +0.17ms
-
emoji-picker-element-database-interactions
  • Browser: chrome-headless 122.0.6261.111
  • Sample size: 50
  • Built by: Benchmarks #406
  • Commit: 8062511
VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
this-change
96.89ms - 104.23ms-unsure 🔍
-7% - +4%
-6.87ms - +3.79ms
tip-of-tree
tip-of-tree
98.23ms - 105.97msunsure 🔍
-4% - +7%
-3.79ms - +6.87ms
-
emoji-picker-element-first-load
  • Browser: chrome-headless 122.0.6261.111
  • Sample size: 50
  • Built by: Benchmarks #406
  • Commit: 8062511
VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
this-change
50.38ms - 53.53ms-unsure 🔍
-5% - +4%
-2.38ms - +1.92ms
tip-of-tree
tip-of-tree
50.72ms - 53.65msunsure 🔍
-4% - +5%
-1.92ms - +2.38ms
-
emoji-picker-element-second-load
  • Browser: chrome-headless 122.0.6261.111
  • Sample size: 50
  • Built by: Benchmarks #406
  • Commit: 8062511
VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
this-change
34.90ms - 37.89ms-unsure 🔍
-7% - +4%
-2.80ms - +1.40ms
tip-of-tree
tip-of-tree
35.62ms - 38.57msunsure 🔍
-4% - +8%
-1.40ms - +2.80ms
-

tachometer-reporter-action v2 for Benchmarks

github-actions[bot] commented 4 months ago

Size Change: +420 B (+1%)

Total Size: 37.1 kB

Filename Size Change
./bundle.js 37.1 kB +420 B (+1%)

compressed-size-action

nolanlawson commented 3 months ago

I'm not sure I can actually get this to work properly. It's so much added complexity, and it still doesn't really improve the perf by doing what I'd really like to do, which is fire off the initial HTTP request before rendering.

It's a nice idea, but it's probably too complex to implement.