Skip to content

perf: make functions common for reduce code size #4111

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

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

This comment has been minimized.

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 (c277c75) to head (4b49a9d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4111      +/-   ##
==========================================
+ Coverage   91.34%   91.66%   +0.31%     
==========================================
  Files         168      169       +1     
  Lines       10700    10686      -14     
  Branches     3181     3098      -83     
==========================================
+ Hits         9774     9795      +21     
+ Misses        925      890      -35     
  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.

Copy link

Bundle size check

main (c277c75) #4111 (117d4ff) +/-
Bundle Size (B) 18,933B 18,583B -350B
Bundle Size (KB) 18.49K 18.15K -0.34K

Compiler Diagnostics

main (c277c75) #4111 (117d4ff) +/-
Files 261 262 1
Lines 116,438 116,450 12
Identifiers 114,433 114,432 -1
Symbols 303,855 303,873 18
Types 214,832 214,834 2
Instantiations 3,091,594 3,091,594 0
Memory used 444,751K 444,586K -165K
I/O read 0.02s 0.02s 0s
I/O write 0s 0s 0s
Parse time 0.67s 0.68s 0.01s
Bind time 0.28s 0.29s 0.01s
Check time 5.77s 5.62s -0.15s
Emit time 0s 0s 0s
Total time 6.72s 6.58s -0.14s

Reported by octocov

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.

1 participant