Skip to content

Add Temporal support & incidental performance improvements#52

Closed
cn-stephen wants to merge 10 commits intoAsyncBanana:masterfrom
cn-stephen:temporal
Closed

Add Temporal support & incidental performance improvements#52
cn-stephen wants to merge 10 commits intoAsyncBanana:masterfrom
cn-stephen:temporal

Conversation

@cn-stephen
Copy link
Copy Markdown

@cn-stephen cn-stephen commented Apr 16, 2026

Hi @AsyncBanana :)

This PR adds runtime support for Temporal types, which otherwise throw at runtime. These ship as fully supported in TypeScript 6.0 and are stage4 https://tc39.es/proposal-temporal/ and solid as heck. They're not going anywhere!

Incidental performance improvements and a couple of tweaks for readability as I was passing through.

Also, a little housekeeping (package-lock, .node-version, quality checks in CI) hope you don't mind.

I hope this is acceptable for your great library!

Benchmark results: master vs temporal

Applied benchmarks

microdiff (no cycles)

Benchmark master temporal delta
PandaCSS Config 12.04 µs 11.51 µs -4%
Scalar/OpenAPI 7.54 µs 7.40 µs -2%
Vanilla Extract 7.00 µs 6.66 µs -5%

microdiff (with cycles)

Benchmark master temporal delta
PandaCSS Config 19.07 µs 13.84 µs -27%
Scalar/OpenAPI 11.00 µs 8.78 µs -20%
Vanilla Extract 9.04 µs 7.65 µs -15%

Geometric mean (applied)

master temporal
microdiff (no cycles) 100% 100%
microdiff (with cycles) 144% 118%

Theoretical benchmarks

microdiff (no cycles)

Benchmark master temporal delta
Large Object (300 props) 13.19 µs 13.41 µs +2%
Large Diff (300 props) 11.33 µs 9.36 µs -17%
Deeply Nested 123.12 µs 111.17 µs -10%
Small Object 69.22 ns 67.39 ns -3%

microdiff (with cycles)

Benchmark master temporal delta
Large Object (300 props) 13.22 µs 13.53 µs +2%
Large Diff (300 props) 11.33 µs 9.31 µs -18%
Deeply Nested 160.75 µs 120.78 µs -25%
Small Object 70.29 ns 67.00 ns -5%

Geometric mean (theoretical)

master temporal
microdiff (no cycles) 100% 100%
microdiff (with cycles) 107% 102%

Summary

  • No regressions in any benchmark
  • Cycles-enabled path improved 15-27% across all applied benchmarks (Set replacing linear array scan + eliminating array copies)
  • No-cycles path improved 2-5% on applied benchmarks (eliminated intermediate .map() allocation)
  • Deeply nested with cycles improved 25% (160.75 µs -> 120.78 µs) — the biggest theoretical win
  • Large diff improved ~17% in both modes (early-exit refactor)
  • Temporal type support added with zero performance cost to existing workloads

@AsyncBanana
Copy link
Copy Markdown
Owner

Thanks! Could you split these changes into multiple pull requests for each feature/optimization?

@cn-stephen
Copy link
Copy Markdown
Author

Split into:

#53
#54
#55

With 1 more to come from https://github.com/cn-stephen/microdiff/pull/1 but relies on the code changes in #55

@cn-stephen cn-stephen closed this Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants