Skip to content

perf(index): load semver comparison functions directly - #623

Merged
Fdawgs merged 1 commit into
mainfrom
perf/direct-semver-imports
Sep 1, 2026
Merged

Fdawgs merged 1 commit into
mainfrom
perf/direct-semver-imports

Conversation

@Fdawgs

@Fdawgs Fdawgs commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Barrel import pulls in the whole of semver for two functions.
Cold start dropped by ~67% by directly importing them, as it's loading 9 modules instead of 46.

Checklist

Copilot AI lite review requested due to automatic review settings September 1, 2026 14:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The change is a small, low-risk refactor and the repository’s semver dependency version supports the semver/functions/* entrypoints.

Pull request overview

This PR optimizes startup performance by avoiding the semver barrel import and instead loading only the specific comparison helpers used by src/index.js, reducing module load overhead during cold start.

Changes:

  • Replaced const { gt, lt } = require("semver") with direct imports from semver/functions/gt and semver/functions/lt.
  • Kept existing call sites (lt(version, ...), gt(version, ...)) unchanged, so behavior should remain identical.
File summaries
File Description
src/index.js Switches semver imports to direct function modules to reduce cold-start module loading.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Fdawgs
Fdawgs merged commit 62ea6a8 into main Sep 1, 2026
18 checks passed
@Fdawgs
Fdawgs deleted the perf/direct-semver-imports branch September 1, 2026 14:34
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