Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(types): improve Utilities in types.ts #3836

Merged
merged 1 commit into from
Jan 19, 2025
Merged

Conversation

yusukebe
Copy link
Member

@yusukebe yusukebe commented Jan 18, 2025

This PR improves the performance of type inferences by updating types.ts.

  • Optimized IntersectNonAnyTypes.

The author should do the following, if applicable

  • Add tests
  • Run tests
  • bun run format:fix && bun run lint:fix to format the code
  • Add TSDoc/JSDoc to document the code

This comment has been minimized.

Copy link

codecov bot commented Jan 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.31%. Comparing base (502709f) to head (85a3ecf).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3836   +/-   ##
=======================================
  Coverage   91.31%   91.31%           
=======================================
  Files         161      161           
  Lines       10240    10240           
  Branches     2997     2997           
=======================================
  Hits         9351     9351           
  Misses        888      888           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This comment has been minimized.

@yusukebe yusukebe force-pushed the perf/utils-in-types-ts branch from cd91be3 to 85a3ecf Compare January 18, 2025 10:23
Copy link

Bundle size check

main (502709f) #3836 (db775aa) +/-
Bundle Size (B) 18,771B 18,771B 0B
Bundle Size (KB) 18.33K 18.33K 0K

Compiler Diagnostics

main (502709f) #3836 (db775aa) +/-
Files 257 257 0
Lines 115,047 115,047 0
Identifiers 112,032 112,032 0
Symbols 243,516 243,516 0
Types 204,790 204,792 2
Instantiations 3,044,415 3,040,322 -4,093
Memory used 420,391K 419,212K -1,179K
I/O read 0.03s 0.02s -0.01s
I/O write 0s 0s 0s
Parse time 0.68s 0.66s -0.02s
Bind time 0.26s 0.27s 0.01s
Check time 5.49s 5.39s -0.1s
Emit time 0s 0s 0s
Total time 6.43s 6.33s -0.1s

Reported by octocov

@yusukebe
Copy link
Member Author

Hey @EdamAme-x

Can you review this?

@yusukebe yusukebe changed the title perf(type): improve Utilities in types.ts perf(types): improve Utilities in types.ts Jan 18, 2025
Copy link
Contributor

@EdamAme-x EdamAme-x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked performance on Bun and found a 1.5x improvement.

runtime: bun 1.1.34 (x64-win32)

benchmark                   avg (min … max) p75 / p99    (min … top 1%)
------------------------------------------- -------------------------------
Before                       652.81 µs/iter 645.40 µs  █
                      (362.30 µs … 4.36 ms)   2.84 ms  █
                    (  0.00  b …   2.87 gb)  91.02 mb ▇██▃▃▃▂▂▁▁▁▁▁▁▁▁▁▁▁▁▁
After                        405.52 µs/iter 398.70 µs  █
                      (285.70 µs … 3.15 ms)   1.49 ms  █
                    (  0.00  b … 524.00 mb)  31.65 mb ██▇▃▄▂▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁

@yusukebe
Copy link
Member Author

@EdamAme-x Thanks!

Merging.

@yusukebe yusukebe merged commit 764dc6d into main Jan 19, 2025
16 checks passed
@yusukebe yusukebe deleted the perf/utils-in-types-ts branch January 19, 2025 06:46
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