-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #568 from leoafarias/fix/which-command
Fix/which command
- Loading branch information
Showing
7 changed files
with
90 additions
and
36 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import 'package:fvm/src/utils/which.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
// Benchmark test for `which` function | ||
// Using a simplistic loop to measure performance. | ||
// For a more accurate benchmark, consider using a benchmarking package. | ||
test('Benchmark: which function', () { | ||
const totalIterations = 1000; | ||
// Setup specific environment variables, as above. | ||
var startTime = DateTime.now(); | ||
for (int i = 0; i < totalIterations; i++) { | ||
which('command', binDir: false); | ||
} | ||
var endTime = DateTime.now(); | ||
var elapsedTime = endTime.difference(startTime); | ||
print( | ||
'Time taken for $totalIterations iterations: ${elapsedTime.inMilliseconds}ms'); | ||
print( | ||
'Time taken for 1 iteration: ${elapsedTime.inMilliseconds / totalIterations}ms', | ||
); | ||
}); | ||
} |