Skip to content

Conversation

@yusukebe
Copy link
Member

This PR reduces the bundle code size with common functions that can't be minified with the bundler.

Created the following functions:

  • createEmptyRecord
  • createResponse

And applied to the core files. I think we don't have to optimize unrelated to the core like under src/middleware now.

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

@github-actions

This comment has been minimized.

@codecov
Copy link

codecov bot commented Apr 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.66%. Comparing base (4eb7979) to head (0fcb7ff).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4111      +/-   ##
==========================================
+ Coverage   91.31%   91.66%   +0.35%     
==========================================
  Files         168      169       +1     
  Lines       10790    10692      -98     
  Branches     3067     3055      -12     
==========================================
- Hits         9853     9801      -52     
+ Misses        936      890      -46     
  Partials        1        1              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

This comment has been minimized.

@github-actions
Copy link

Bundle size check

main (4eb7979) #4111 (95cbc44) +/-
Bundle Size (B) 18,979B 18,629B -350B
Bundle Size (KB) 18.53K 18.19K -0.34K

Compiler Diagnostics (tsc)

main (4eb7979) #4111 (95cbc44) +/-
Files 261 262 1
Lines 116,440 116,452 12
Identifiers 114,437 114,436 -1
Symbols 259,899 259,917 18
Types 162,567 162,569 2
Instantiations 3,039,293 3,039,293 0
Memory used 272,781K 273,082K 301K
I/O read 0.03s 0.02s -0.01s
I/O write 0s 0s 0s
Parse time 0.68s 0.65s -0.03s
Bind time 0.28s 0.28s 0s
Check time 4.04s 3.78s -0.26s
Emit time 0s 0s 0s
Total time 5s 4.72s -0.28s

Reported by octocov

@github-actions
Copy link

Bundle size check

main (4eb7979) #4111 (95cbc44) +/-
Bundle Size (B) 18,979B 18,629B -350B
Bundle Size (KB) 18.53K 18.19K -0.34K

Compiler Diagnostics (typescript-go)

main (4eb7979) #4111 (95cbc44) +/-
Files 231 232 1
Lines 106,339 106,351 12
Identifiers 106,177 106,176 -1
Symbols 371,550 351,269 -20,281
Types 292,987 286,488 -6,499
Instantiations 3,568,485 3,545,794 -22,691
Memory used 229,637K 221,216K -8,421K
Memory allocs 10,003,491 9,944,001 -59,490
Parse time 0.071s 0.066s -0.005s
Bind time 0.031s 0.02s -0.011s
Check time 1.391s 1.478s 0.087s
Emit time 0s 0s 0s
Total time 1.504s 1.565s 0.061s

Reported by octocov

@yusukebe yusukebe marked this pull request as ready for review May 31, 2025 20:34
@yusukebe
Copy link
Member Author

Hey @EdamAme-x

Do you think merging this PR is worth it? If so, please review this.

@yusukebe
Copy link
Member Author

yusukebe commented Jun 8, 2025

Hello @usualoma !

What do you think of this optimization?

@usualoma
Copy link
Member

usualoma commented Jun 8, 2025

Hi @yusukebe.
Thank you!

If you ask me if it's really necessary, I'd say it's a gray area, but I don't think it will reduce maintainability, so it's fine.

@yusukebe
Copy link
Member Author

yusukebe commented Jun 9, 2025

@usualoma

Thanks! I also think this is a "gray area". I'll decide whether to merge later.

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.

3 participants