Skip to content

perf: removed fnc creation in handler fnc to avoid closure creation#505

Open
exvillager wants to merge 2 commits into
tinyhttp:masterfrom
exvillager:perf/improve-some-perf
Open

perf: removed fnc creation in handler fnc to avoid closure creation#505
exvillager wants to merge 2 commits into
tinyhttp:masterfrom
exvillager:perf/improve-some-perf

Conversation

@exvillager

@exvillager exvillager commented Jul 12, 2026

Copy link
Copy Markdown

Description

Refactors the request handler method in the App class to avoid allocating new
function closures (loop and handle) on every incoming HTTP request.

Key Changes

  • Extracted loop and handle logic into private helper methods (#loop and
    #handle) on the App class.

Benefits

  • Throughput: Decreases function instantiation overhead per request.
  • Tail Latency: Reduces GC (Garbage Collection) pressure under high throughput,
    leading to more stable tail latencies (p99/p99.9).

Brace placement and empty-arrow-function spacing violated the
project's Biome format rules, which fails `biome ci .` in CI.
@exvillager exvillager marked this pull request as ready for review July 12, 2026 06:30
@exvillager

Copy link
Copy Markdown
Author

@v1rtl check this PR.
it improves the application performance and tail latency.

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