Skip to content

refactor: replace nanosecond-based timing with atomic second counter#83

Merged
linkdata merged 3 commits into
mainfrom
perf/runtime-seconds-counter
Jun 18, 2026
Merged

refactor: replace nanosecond-based timing with atomic second counter#83
linkdata merged 3 commits into
mainfrom
perf/runtime-seconds-counter

Conversation

@linkdata

Copy link
Copy Markdown
Owner
  • Replace nowNano() method and created-based nanosecond timestamps with an atomic runtimeSeconds counter refreshed by the Serve loop.
  • Update eviction and idle checks to use whole seconds instead of nanoseconds, improving performance by avoiding clock reads on hot paths.
  • Adjust test helpers to accept seconds-ago values directly for clarity and consistency.

linkdata added 3 commits June 18, 2026 16:08
- Replace `nowNano()` method and `created`-based nanosecond timestamps with an atomic `runtimeSeconds` counter refreshed by the Serve loop.
- Update eviction and idle checks to use whole seconds instead of nanoseconds, improving performance by avoiding clock reads on hot paths.
- Adjust test helpers to accept seconds-ago values directly for clarity and consistency.

Signed-off-by: Johan Lindh <johan@linkdata.se>
…tion logic

- Add comment explaining uint32 conversion safety for process uptime
- Replace lossy uint32-based spare seconds calculation with duration comparison
- Ensure minimum spare window of 1 second to match counter granularity

Signed-off-by: Johan Lindh <johan@linkdata.se>
Signed-off-by: Johan Lindh <johan@linkdata.se>
@linkdata linkdata merged commit 7e5b9d4 into main Jun 18, 2026
6 checks passed
@linkdata linkdata deleted the perf/runtime-seconds-counter branch June 18, 2026 14:29
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