Skip to content

Commit

Permalink
Optimize /inscription endpoint (#2884)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Dec 25, 2023
1 parent ee0a1a3 commit 8b38b32
Show file tree
Hide file tree
Showing 14 changed files with 489 additions and 225 deletions.
102 changes: 102 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,17 @@ tokio-util = {version = "0.7.3", features = ["compat"] }
tower-http = { version = "0.4.0", features = ["compression-br", "compression-gzip", "cors", "set-header"] }

[dev-dependencies]
criterion = "0.5.1"
executable-path = "1.0.0"
pretty_assertions = "1.2.1"
reqwest = { version = "0.11.10", features = ["blocking", "brotli", "json"] }
test-bitcoincore-rpc = { path = "test-bitcoincore-rpc" }
unindent = "0.2.1"

[[bench]]
name = "server"
harness = false

[[bin]]
name = "ord"
path = "src/bin/main.rs"
Expand Down
16 changes: 16 additions & 0 deletions benches/server.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use {criterion::Criterion, ord::Index};

fn main() {
let mut criterion = Criterion::default().configure_from_args();
let index = Index::open(&Default::default()).unwrap();
let mut i = 0;

criterion.bench_function("inscription", |b| {
b.iter(|| {
Index::inscription_info_benchmark(&index, i);
i += 1;
});
});

Criterion::default().configure_from_args().final_summary();
}
3 changes: 3 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,6 @@ audit-cache:

coverage:
cargo llvm-cov

benchmark-server:
cargo bench --bench server
Loading

0 comments on commit 8b38b32

Please sign in to comment.