Closed JoshuaKGoldberg closed 4 months ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
goober-rocks | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Aug 13, 2023 4:21am |
Ping @cristianbote, is the challenge still active? I enjoyed this PR, but it did take some time to get to. If this repo isn't active anymore I'd think it'd be best to make that clear.
👋 hi! I just learned about this repo's performance challenge. Very fun. It's pretty optimized as-it-is, so most things I tried didn't result in any positive impact in
goober.modern.js
after gzipping locally.But, I did find two changes that each showed small improvements locally:
wrapper
function withinstyled.js
, switching thelet _args = arguments
to a modern...args
rest (thereby also changing the function to an=>
arrow lambda)?.
optional chaining as syntax sugar indist/goober.modern.js
whenever possible, as optional chaining is supported in modern environments per caniuse's optional chaining query and kangax's optional chaining rowFiles created by running:
npm run build
gzip dist/goober.modern.js --best
Measurements taken by opening Get Info on Mac.
goober.modern.js
goober.modern.js.gz
.gz
Δ (bytes)_args
?.
_args
and?.
Note: Optional chaining is implemented right now with typescript-eslint's
@typescript-eslint/prefer-optional-chain
. Which is a very silly, over-the-top way to get this to work... but all the alternatives I'd tried didn't work!src/
files and adding'@babel/plugin-syntax-logical-assignment-operators'
tobabel.config.cjs
, but even after updating to the latest@babel/*
packages, it kept transpiling down tonull==...
checks indist/
g && g()
in the output (blocked on https://github.com/villesau/optional-chaining-codemod/issues/51)If you know a way to get optional chaining to work in an output bundle without installing four dev dependencies, please let me know!