PHANTOM
🇮🇳 IN
Skip to content

perf(context): use createResponseInstance for new Response#4733

Merged
yusukebe merged 2 commits intonextfrom
perf/context-create-response-instance
Feb 19, 2026
Merged

perf(context): use createResponseInstance for new Response#4733
yusukebe merged 2 commits intonextfrom
perf/context-create-response-instance

Conversation

@yusukebe
Copy link
Member

@yusukebe yusukebe commented Feb 19, 2026

This PR introduces the createResponseInstance() shortcut function for new Response() in context.ts. As a result, the bundle size will decrease 35B. It's super slight, but Hono should be as small as possible.

However, createResponseInstance() is used in only context.ts. To keep maintainability, don't use it anywhere.

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.

@github-actions

This comment has been minimized.

@codecov
Copy link

codecov bot commented Feb 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.48%. Comparing base (bd26c31) to head (510d545).
⚠️ Report is 1 commits behind head on next.

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #4733   +/-   ##
=======================================
  Coverage   91.48%   91.48%           
=======================================
  Files         177      177           
  Lines       11552    11556    +4     
  Branches     3358     3357    -1     
=======================================
+ Hits        10568    10572    +4     
  Misses        983      983           
  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.

@yusukebe yusukebe changed the base branch from main to next February 19, 2026 10:56
@github-actions
Copy link

Bundle size check

main (67ac19a) #4733 (3ff0b3e) +/-
Bundle Size (B) 18,438B 18,528B 90B
Bundle Size (KB) 18.01K 18.09K 0.08K

Compiler Diagnostics (tsc)

main (67ac19a) #4733 (3ff0b3e) +/-
Files 303 303 0
Lines 141,178 141,268 90
Identifiers 128,953 129,114 161
Symbols 269,501 270,134 633
Types 202,701 203,192 491
Instantiations 609,801 610,147 346
Memory used 345,185K 343,851K -1,334K
I/O read 0.02s 0.03s 0.01s
I/O write 0s 0s 0s
Parse time 0.7s 0.7s 0s
Bind time 0.3s 0.3s 0s
Check time 2.44s 2.51s 0.07s
Emit time 0s 0s 0s
Total time 3.45s 3.51s 0.06s

Compiler Diagnostics (typescript-go)

main (67ac19a) #4733 (3ff0b3e) +/-
Files 303 303 0
Lines 145,359 145,449 90
Identifiers 130,544 130,705 161
Symbols 390,981 391,797 816
Types 372,849 373,354 505
Instantiations 984,004 984,371 367
Memory used 254,990K 255,596K 606K
Memory allocs 2,552,964 2,582,538 29,574
Config time 0.001s 0.001s 0s
Parse time 0.103s 0.101s -0.002s
Bind time 0.028s 0.02s -0.008s
Check time 0.628s 0.601s -0.027s
Emit time 0s 0s 0s
Total time 0.806s 0.768s -0.038s

Reported by octocov

@github-actions
Copy link

HTTP Performance Benchmark

Framework Runtime Average Ping Query Body
hono (origin/main) bun 34,025.40 47,588.51 29,767.97 24,719.72
hono (current) bun 35,185.78 47,230.62 31,371.95 26,954.76
Change +3.41% -0.75% +5.39% +9.04%

@yusukebe yusukebe merged commit a340a25 into next Feb 19, 2026
20 checks passed
@yusukebe yusukebe deleted the perf/context-create-response-instance branch February 19, 2026 10:59
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