Skip to content

Compress common CSS property keys - #1839

Draft
nmn wants to merge 1 commit into
mainfrom
chore/better-compressed-keys
Draft

Compress common CSS property keys#1839
nmn wants to merge 1 commit into
mainfrom
chore/better-compressed-keys

Conversation

@nmn

@nmn nmn commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add a curated mapping of human-readable 1–3 character shorthands for common CSS properties
  • use those shorthands for compressed keys in compiled stylex.create objects
  • retain hash-based keys for uncommon properties and conditional declarations
  • update compiler, CLI, and Rollup snapshots

This is the first PR in a two-PR stack. Follow-up: #1840.

Test plan

  • npm run build
  • npm run docs:build
  • npm run flow -- --show-all-errors
  • npm run typescript
  • npm run prettier:report
  • npm run lint:report
  • npm run test:packages

@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
stylex Ignored Ignored Sep 3, 2026 8:26am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

workflow: benchmarks/perf

Comparison of performance test results, measured in operations per second. Larger is better.
yarn workspace v1.22.22
yarn run v1.22.22
$ node ./compare.js /tmp/tmp.TsQjFhrSHO /tmp/tmp.0hZCg2Vl67

Results Base Patch Ratio
babel-plugin: stylex.create
· basic create 746 717 0.96 -
· complex create 97 90 0.93 !!
babel-plugin: stylex.createTheme
· basic themes 600 559 0.93 !!
· complex themes 47 45 0.96 -
Done in 0.06s.
Done in 0.24s.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

workflow: benchmarks/size

Comparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better.
yarn workspace v1.22.22
yarn run v1.22.22
$ node ./compare.js /tmp/tmp.4y2ortuz1H /tmp/tmp.rOwoWiyQwQ

Results Base Patch Ratio
@stylexjs/stylex/lib/cjs/stylex.js
· compressed 1,535 1,535 1.00
· minified 5,166 5,166 1.00
@stylexjs/stylex/lib/cjs/inject.js
· compressed 1,793 1,793 1.00
· minified 4,915 4,915 1.00
benchmarks/size/.build/bundle.js
· compressed 496,650 486,580 0.98 -
· minified 4,847,840 4,076,568 0.84 !!
benchmarks/size/.build/stylex.css
· compressed 99,757 99,757 1.00
· minified 748,850 748,850 1.00
Done in 0.08s.
Done in 0.32s.

@nmn
nmn force-pushed the chore/better-compressed-keys branch from 6d06bdc to a4783d9 Compare September 3, 2026 08:23
@nmn
nmn force-pushed the chore/better-compressed-keys branch from a4783d9 to f5eb6fa Compare September 3, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant