Skip to content
Projets

kurtextrem/awesome-performance-patches

Voir sur GitHub

À propos

🚀⚡ Awesome list about performance related patches/PRs.

Apprentissage et éducation

Comment ces chiffres sont mesurés

Progression mesurée des étoiles

in 24h
0
in 7 days
+1
in 15 days
+9
in 1 month
Historique en cours

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

README.md

Original

Awesome Performance Patches Awesome

🚀⚡ Awesome lists about performance related patches/PRs.

The purpose of this awesome list is to allow others to learn from performance improvements of the past 📝, so that you can submit your performance improvement sooner or later here as well 🤝.

The list also includes blog posts without PRs, if they contain enough code to make them useful for this purpose.
⭐ marks blog posts or articles covering a lot of areas with in-depth explanations.

New here? The performance course is a quick, self-paced intro to the findings in this list: 28 short lessons with diagrams and runnable demos.

For Web Performance, there are a few more lists of curated links of talks, newsletters, blogs and more:
➡️ fabkrum/web-performance-resources ➡️ imteekay/web-performance-research ➡️ nucliweb/webperf-snippets

Hint: What improves performance might change over time; always re-validate assumptions by using a reliable benchmarking tool such as mitata or Tachometer.
Follow me on Twitter for updates.

Contents

JavaScript

Patches focused on JavaScript performance improvements. Guides:

Caching / Doing less work

Data Structures

Unsorted

  • node-semver - Bit flags instead of string manipulation
  • node-semver - Object#freeze for lower memory consumption at around equal perf
  • typescript - var is faster than let/const in the specific use case of TypeScript
  • three.js - prevent memory leak from sliced strings
  • graphql-js - for..of downtranspilation & destructuring optimization
  • preact/signals - convert ES6 classes to ES5 classes for higher performance
  • fabianhiller/valibot - lazy evaluation, "is object" check via var?.constructor !== Object, array tuples to flat array
  • nodejs/node - replace N boolean props with one bitmap
  • fabianhiller/valibot - avoid (negative) look-aheads for faster regexp execution
  • ai/nanoid - re-ordered alphabet for smaller brotli compression
  • astro - AsyncIterable instead of a ReadableStream
  • TanStack/query - avoid too frequent setTimeout & cancelTimeout -> setTimeout appears more expensive than it truly is in DevTools, see this
  • react - maintain the same object key across the code to avoid causing de-opts
  • typescript (PR #2) - ensure objects have a consistent set of properties with a consistent initialization order ("monomorphism"), related to hidden classes. See also Monomorphic AST Nodes
  • microsoft/vscode-js-debug - faster stream splitting
  • fastify - indexOf -> slice to reduce worst-case runtime duration
  • vitejs/vite - caches repeated import() calls (see also, tweet)
  • nodejs/undici - converts object argument to plain arguments (see also DevTools & Preact hotpath, Fastify, Hermes)
  • unjs/unhead - reduces Promise use, optimizes arrays to Set, replaces string.split with string.indexOf() + string.substring() and more
  • vuejs/core - improve SSR perf by avoiding Promise creation
  • astro - improve SSR perf by avoiding Promise creation
  • astro - avoid spread
  • ariakit - React: avoid too frequent calls to useSyncExternalStore (blog)
  • ariakit - Avoid high amount of calls to addEventListener
  • mrousavy/nitro - Replace path.join with str.join
  • typescript - Avoid "pass-through" function expressions (const foo = (str) => bar(str) -> const foo = bar)
  • remix-run/react-router - Avoid writing to new URL().searchParams, use new URLSearchParams() instead.
  • immerjs/immer - At >1020 props (in v8), {…base} is faster than Object.keys()
  • astro - calling TextEncode#encode N times with small strings is slower than 1x with a large string
  • TanStack/router - new URL can be expensive; use simple checks to prevent obj alloc (PR #2, PR #3)
  • Tweet - os.cpus().length is slow, prefer os.availableParallelism()
  • open-telemetry/opentelemetry-js - prefer plain for..in and pre-allocated arrays (new Array(len)) over Object.entries (PR #2)
  • rocicorp/mono - replace Iterators with manual implementation (for loop under the hood)
  • ai/nanoid - faster string generation via Buffer#toString instead of str += char explainer
  • react - Error.stackTraceLimit = 10 to make throwing Error cheaper/faster to run
  • cometkim/unicode-segmenter - micro-optimization for the various v8 compilers (turbofan, meglev)
  • oxc-project/oxc - prefer Object.create over __proto__

Blog Posts with Code 📖

Algorithmic 📖

Perf Audits 📝

CSS & Rendering

Patches focused on CSS performance improvements.

Blog Posts with Code 📖

Animations 💫

HTML & Core Web Vitals 📈

Patches focused on HTML & Core Web Vitals performance improvements.

  • sentry - replaces React's autofocus implementation with manual focus in the next task for improved INP
  • radix-ui/primitives - sets CSS inline style on <body> after giving the browser a chance to paint for improved INP
  • nkzw-tech/athena-crisis - moves rendering of 1000 images from <img> to canvas to drastically reduce memory footprint

Guides:

TypeScript

Patches focused on TypeScript runtime performance improvements (e.g. running tsc). The TS team also has a dedicated wiki page. Attest can help you benchmark.

  • sentry - avoid large unions in favor of interfaces
  • tRPC - avoid disabling the lazy evaluation of TypeScript types
  • TanStack/router

Guides 📖:

VSCode

Contribute

Contributions welcome! Read the contribution guidelines first.

Explorer des projets similaires

Chargement…