fix(bench): incorrect opening method in @napi-rs/simple-git repository#120
Merged
fix(bench): incorrect opening method in @napi-rs/simple-git repository#120
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
seokju-na
approved these changes
Apr 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR corrects the method used to open an existing repository in the benchmark code (
benchmarks/index.bench.ts) for@napi-rs/simple-git.Problem
The benchmark test for opening a repository in
@napi-rs/simple-gitwas incorrectly using theSimpleGitRepository.init(gitDir)method. This method initializes a new repository, whereas the benchmark should be testing the opening of an existing repository. This usage contradicts the intended functionality documented in the library.According to the library documentation:
Repository.init('/path/to/repo'): Initializes a new Git repository at the specified path.new Repository('/path/to/repo'): Opens an existing repository.In the context of this benchmark, the goal is to measure the performance of opening a pre-existing repository. Therefore, the use of
initwas incorrect.Solution
The benchmark code has been updated to use the correct method for opening an existing repository, which is the constructor call:
new SimpleGitRepository(gitDir).Expected Outcome
This correction ensures that the benchmark for the repository opening feature of
@napi-rs/simple-gitaccurately reflects the correct usage pattern of the library.