-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
84 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[submodule "benches/django"] | ||
path = benches/django | ||
url = [email protected]:django/django.git | ||
[submodule "benches/kubernetes"] | ||
path = benches/kubernetes | ||
url = [email protected]:kubernetes/kubernetes.git | ||
[submodule "benches/pydantic"] | ||
path = benches/pydantic | ||
url = [email protected]:pydantic/pydantic.git |
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,52 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
setup() { | ||
sudo --validate | ||
|
||
command -v hyperfine >/dev/null || cargo install hyperfine | ||
|
||
git submodule init | ||
git submodule update | ||
|
||
cargo build --release | ||
cp target/release/srgn benches/ | ||
} | ||
|
||
bench() { | ||
# https://www.kernel.org/doc/Documentation/sysctl/vm.txt: | ||
local wipe_caches='sync; echo 3 | sudo tee /proc/sys/vm/drop_caches' | ||
|
||
( | ||
cd benches | ||
|
||
for i in \ | ||
"python comments py django,pydantic" \ | ||
"go comments go kubernetes" | ||
do | ||
# We WANT splitting here: https://stackoverflow.com/a/52228219/11477374 | ||
# shellcheck disable=SC2086 | ||
set -- $i | ||
|
||
local lang="$1" | ||
local query_type="$2" | ||
local file_suffix="$3" | ||
local repos="$4" # Can be a comma-separated list | ||
|
||
hyperfine \ | ||
--max-runs 3 \ | ||
--prepare "$wipe_caches" \ | ||
--cleanup "git restore --recurse-submodules {repo}" \ | ||
--parameter-list repo "$repos" \ | ||
--parameter-list find "e+,[Tt]he" \ | ||
--parameter-list replace "_,🙂" \ | ||
"./srgn --fail-empty-glob --$lang $query_type --files '{repo}/**/*.$file_suffix' '{find}' '{replace}'" | ||
done | ||
) | ||
} | ||
|
||
setup | ||
bench |
Submodule kubernetes
added at
5639f8