Skip to content

Conversation

@usualoma
Copy link
Member

The presence of computed properties led to the determination that side effects were possible, resulting in larger bundled code.

file

import { PreparedRegExpRouter } from './src/router/reg-exp-router'
console.log(PreparedRegExpRouter)

bundle size

main branch

$ npx esbuild --bundle prr.ts | wc
     464    1619   15633

refactor/prepared-computed-property branch

$ npx esbuild --bundle import.ts | wc
      92     262    2790

The author should do the following, if applicable

  • Run tests
  • bun run format:fix && bun run lint:fix to format the code

@usualoma
Copy link
Member Author

@yusukebe
Would you please review this?

@github-actions
Copy link

Bundle size check

main (3b8642b) #4458 (6c99104) +/-
Bundle Size (B) 19,051B 18,335B -716B
Bundle Size (KB) 18.6K 17.91K -0.69K

Compiler Diagnostics (tsc)

main (3b8642b) #4458 (6c99104) +/-
Files 302 302 0
Lines 140,361 140,365 4
Identifiers 127,389 127,393 4
Symbols 267,294 267,313 19
Types 156,800 156,815 15
Instantiations 539,897 539,907 10
Memory used 316,171K 323,701K 7,530K
I/O read 0.03s 0.03s 0s
I/O write 0s 0s 0s
Parse time 0.72s 0.76s 0.04s
Bind time 0.29s 0.31s 0.02s
Check time 2.7s 3.03s 0.33s
Emit time 0s 0s 0s
Total time 3.71s 4.09s 0.38s

Compiler Diagnostics (typescript-go)

main (3b8642b) #4458 (6c99104) +/-
Files 271 271 0
Lines 118,250 118,254 4
Identifiers 116,822 116,826 4
Symbols 374,777 374,798 21
Types 283,359 283,369 10
Instantiations 3,549,226 3,549,238 12
Memory used 229,368K 229,279K -89K
Memory allocs 10,119,816 10,120,104 288
Parse time 0.096s 0.081s -0.015s
Bind time 0.026s 0.018s -0.008s
Check time 1.495s 1.648s 0.153s
Emit time 0s 0s 0s
Total time 1.627s 1.754s 0.127s

Reported by octocov

@github-actions
Copy link

HTTP Performance Benchmark

Framework Runtime Average Ping Query Body
hono (origin/main) bun 37,498.42 51,998.24 32,976.45 27,520.56
hono (current) bun 37,202.98 51,518.96 32,633.36 27,456.61
Change -0.79% -0.92% -1.04% -0.23%

@codecov
Copy link

codecov bot commented Oct 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.29%. Comparing base (3b8642b) to head (0c98e13).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4458      +/-   ##
==========================================
+ Coverage   91.28%   91.29%   +0.01%     
==========================================
  Files         173      173              
  Lines       11064    11067       +3     
  Branches     3189     3190       +1     
==========================================
+ Hits        10100    10104       +4     
+ Misses        963      962       -1     
  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.

import type { HandlerData, Matcher, MatcherMap, StaticMap } from './matcher'
import { match, buildAllMatchersKey, emptyParam } from './matcher'
import { match, emptyParam } from './matcher'
import { RegExpRouter } from './router'
Copy link
Member

@yusukebe yusukebe Oct 13, 2025

Choose a reason for hiding this comment

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

This is not related to this PR, but it uses only the type so that you can write like this:

import type { RegExpRouter } from './router'

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for your comment.
We're using it as a base class here!

If bundling doesn't produce the intended result, I think it's possible to separate the files to minimize the impact.

https://github.com/honojs/hono/pull/4458/files/0c98e13168f338ce40553cbb7dd97d7f0b3fe131#diff-05f98af8ac89c7dd686b79c41d8167478c790c0051245d79c3b0f0554351dc63R75

Copy link
Member

Choose a reason for hiding this comment

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

@usualoma Ah, class! Sorry, my misunderstanding. It's okay as it is.

@yusukebe
Copy link
Member

@usualoma

I confirmed this change affects the new project and reduces the file size without RegExpRouter. Thanks! I've left a comment.

Copy link
Member

@yusukebe yusukebe left a comment

Choose a reason for hiding this comment

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

LGTM!

@yusukebe
Copy link
Member

@usualoma

Looks good! Thank you for the great work.

@yusukebe yusukebe merged commit 17e4455 into main Oct 13, 2025
20 checks passed
@yusukebe yusukebe deleted the refactor/prepared-computed-property branch October 13, 2025 07:05
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