-
-
Notifications
You must be signed in to change notification settings - Fork 6
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 #647 from jewlexx/scoop-cache-benchmarks
search: update benchmarks
- Loading branch information
Showing
3 changed files
with
112 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/outputs |
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,50 @@ | ||
function BenchCommands | ||
{ | ||
param( | ||
[parameter(Mandatory = $true)] | ||
[String[]]$Commands, | ||
[parameter(Mandatory = $false)] | ||
[String]$OutDir, | ||
[parameter(Mandatory = $false)] | ||
[String]$OutFile | ||
) | ||
|
||
if (-Not $PSBoundParameters.ContainsKey('OutDir')) | ||
{ | ||
$OutDir = "$PSScriptRoot/outputs" | ||
mkdir $OutDir -ErrorAction SilentlyContinue | ||
} | ||
|
||
if (-Not $PSBoundParameters.ContainsKey('OutFile')) | ||
{ | ||
$OutFile = "$(($Commands[0] -split ' ')[1])" | ||
} | ||
$FileName = "$OutDir/$OutFile.txt" | ||
|
||
Write-Output "$ hyperfine --warmup 5 $($commands | ForEach-Object { "'$($_)'" })" > $FileName | ||
hyperfine --warmup 5 $Commands >> $FileName | ||
} | ||
|
||
# Set current branch to develop | ||
scoop config scoop_branch develop | ||
pwsh -NoProfile -C 'scoop update' | ||
|
||
# Listing | ||
Write-Output 'Benchmarking listing commands' | ||
BenchCommands @('sfsu list', 'hok list', 'scoop list') | ||
|
||
# Searching | ||
## Without sqlite cache | ||
Write-Output 'Benchmarking search without cache' | ||
scoop config use_sqlite_cache false | ||
BenchCommands @('sfsu search google', 'hok search google', 'scoop-search google', 'scoop search google') | ||
|
||
## With sqlite cache | ||
scoop config use_sqlite_cache true | ||
Write-Output 'Benchmarking search with cache' | ||
BenchCommands @('sfsu search google', 'scoop search google') -OutFile 'search_cached' | ||
|
||
# Info | ||
Write-Output 'Benchmarking info' | ||
BenchCommands @('sfsu info sfsu --disable-updated', 'hok info sfsu') -OutFile 'info_hok' | ||
BenchCommands @('sfsu info sfsu', 'scoop info sfsu') |