Skip to content

Conversation

@jeremylcarter
Copy link
Contributor

@jeremylcarter jeremylcarter commented Feb 3, 2026

Summary

  • Ref-count timers to keep the interpreter event loop alive by default and release on cancel/finish.
  • Switch the event loop to a blocking callback queue with SynchronizationContext dispatch for lower idle CPU and correct main-thread callbacks.
  • Add interpreted-only tests for timer keep-alive and unref() exit behavior.

Testing

File: web-server.ts
Test: loadtest http://localhost:3000
Results:

Updated interpreter (SharpTS)

Target URL:          http://localhost:3000
Max time (s):        10
Concurrent clients:  80
Running on cores:    8
Agent:               none

Completed requests:  62251
Total errors:        0
Total time:          10.028 s
Mean latency:        12.3 ms
Effective rps:       6208

Previous interpreter (SharpTS)

Target URL:          http://localhost:3000
Max time (s):        10
Concurrent clients:  80
Running on cores:    8
Agent:               none

Completed requests:  6560
Total errors:        0
Total time:          10.05 s
Mean latency:        120.9 ms
Effective rps:       653

NodeJS - web-server.ts

Target URL:          http://localhost:3000
Max time (s):        10
Concurrent clients:  80
Running on cores:    8
Agent:               none

Completed requests:  19526
Total errors:        1127
Total time:          10.036 s
Mean latency:        40.2 ms
Effective rps:       1946

Ref-count timers to keep the loop alive by default and integrate a blocking
callback queue with SynchronizationContext dispatch. Add interpreted-only
tests for timer keep-alive/unref behavior and update timeout ref tracking.
Copy link
Owner

@nickna nickna left a comment

Choose a reason for hiding this comment

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

Nice. This is clever and effective.

@nickna nickna merged commit 98e2285 into nickna:main Feb 4, 2026
3 checks passed
nickna pushed a commit that referenced this pull request Feb 4, 2026
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.

2 participants