-
Notifications
You must be signed in to change notification settings - Fork 1
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
3 changed files
with
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# Install: | ||
# HYPERFINE_VERSION="1.12.0" | ||
# wget https://github.com/sharkdp/hyperfine/releases/download/v${HYPERFINE_VERSION}/hyperfine_${HYPERFINE_VERSION}_amd64.deb | ||
# sudo dpkg -i hyperfine_${HYPERFINE_VERSION}_amd64.deb | ||
|
||
source .venv/bin/activate | ||
|
||
pip install --upgrade curies | ||
|
||
maturin develop --release -m python/Cargo.toml | ||
maturin build --release -m python/Cargo.toml | ||
pip install --no-index --find-links=target/wheels/ curies-rs | ||
|
||
# m = number of run | ||
hyperfine -m 6 --warmup 3 --export-markdown benchmark.md \ | ||
'python scripts/benchmark_rust.py' \ | ||
'python scripts/benchmark_python.py' | ||
|
||
|
||
# Benchmark 1: python scripts/benchmark_rust.py | ||
# Time (mean ± σ): 463.6 ms ± 24.1 ms [User: 217.4 ms, System: 38.3 ms] | ||
# Range (min … max): 438.4 ms … 499.7 ms 6 runs | ||
|
||
# Benchmark 2: python scripts/benchmark_python.py | ||
# Time (mean ± σ): 11.232 s ± 1.557 s [User: 10.847 s, System: 0.060 s] | ||
# Range (min … max): 10.094 s … 14.161 s 6 runs | ||
|
||
# Summary | ||
# 'python scripts/benchmark_rust.py' ran | ||
# 24.23 ± 3.59 times faster than 'python scripts/benchmark_python.py' |
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 @@ | ||
import curies | ||
|
||
# converter = curies.get_bioregistry_converter() | ||
url = "https://raw.githubusercontent.com/biopragmatics/bioregistry/main/exports/contexts/bioregistry.epm.json" | ||
converter = curies.load_extended_prefix_map(url) | ||
|
||
curie = converter.compress("http://purl.obolibrary.org/obo/DOID_1234") | ||
|
||
print(curie) |
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,8 @@ | ||
from curies_rs import Converter | ||
|
||
url = "https://raw.githubusercontent.com/biopragmatics/bioregistry/main/exports/contexts/bioregistry.epm.json" | ||
converter = Converter.load_extended_prefix_map(url) | ||
|
||
curie = converter.compress("http://purl.obolibrary.org/obo/DOID_1234") | ||
|
||
print(curie) |