diff --git a/crates/brk_bencher/README.md b/crates/brk_bencher/README.md index 65ccbfb1e..d4814dcab 100644 --- a/crates/brk_bencher/README.md +++ b/crates/brk_bencher/README.md @@ -16,7 +16,7 @@ Track disk usage, memory consumption (current + peak), and I/O throughput during ## Core API -```rust +```rust,ignore let mut bencher = Bencher::from_cargo_env("brk_indexer", &data_path)?; bencher.start()?; diff --git a/crates/brk_bencher_visualizer/README.md b/crates/brk_bencher_visualizer/README.md index 76ba1c83f..6b2a95655 100644 --- a/crates/brk_bencher_visualizer/README.md +++ b/crates/brk_bencher_visualizer/README.md @@ -16,7 +16,7 @@ Turn benchmark CSV data into publication-ready SVG charts showing disk usage, me ## Core API -```rust +```rust,ignore let viz = Visualizer::from_cargo_env()?; viz.generate_all_charts()?; // Process all crates in benches/ ``` diff --git a/crates/brk_binder/README.md b/crates/brk_binder/README.md index 99b54294a..c0d18f8ac 100644 --- a/crates/brk_binder/README.md +++ b/crates/brk_binder/README.md @@ -15,7 +15,7 @@ Generate typed metric catalogs and constants for JavaScript/TypeScript clients. ## Core API -```rust +```rust,ignore generate_js_files(&query, &modules_path)?; ``` diff --git a/crates/brk_computer/README.md b/crates/brk_computer/README.md index 6d84b9f77..3b2708627 100644 --- a/crates/brk_computer/README.md +++ b/crates/brk_computer/README.md @@ -48,6 +48,10 @@ UTXO and address cohorts support filtering by: - **Type**: P2PKH, P2SH, P2WPKH, P2WSH, P2TR - **Epoch**: By halving epoch +## Recommended: mimalloc v3 + +Use [mimalloc v3](https://crates.io/crates/mimalloc) as the global allocator to reduce memory usage. + ## Built On - `brk_indexer` for indexed blockchain data diff --git a/crates/brk_grouper/README.md b/crates/brk_grouper/README.md index de48a25bc..eff8810fa 100644 --- a/crates/brk_grouper/README.md +++ b/crates/brk_grouper/README.md @@ -18,7 +18,7 @@ Slice the UTXO set and address population by age, amount, output type, halving e ## Filter Types -```rust +```rust,ignore pub enum Filter { All, Term(Term), // STH/LTH @@ -31,7 +31,7 @@ pub enum Filter { ## Core API -```rust +```rust,ignore let filter = Filter::Time(TimeFilter::GreaterOrEqual(155)); // Check membership diff --git a/crates/brk_indexer/README.md b/crates/brk_indexer/README.md index 26441c005..f98688ed9 100644 --- a/crates/brk_indexer/README.md +++ b/crates/brk_indexer/README.md @@ -17,7 +17,7 @@ Transform raw Bitcoin blockchain data into indexed vectors and key-value stores ## Core API -```rust +```rust,ignore let mut indexer = Indexer::forced_import(&outputs_dir)?; // Index new blocks @@ -60,6 +60,10 @@ let blockhash = indexer.vecs.block.height_to_blockhash.get(height)?; Full benchmark data: [`/benches/brk_indexer`](/benches/brk_indexer) +## Recommended: mimalloc v3 + +Use [mimalloc v3](https://crates.io/crates/mimalloc) as the global allocator to reduce memory usage. + ## Built On - `brk_iterator` for block iteration diff --git a/crates/brk_iterator/README.md b/crates/brk_iterator/README.md index 53d0e7e5b..1c6168161 100644 --- a/crates/brk_iterator/README.md +++ b/crates/brk_iterator/README.md @@ -15,7 +15,7 @@ Iterate over Bitcoin blocks with a simple API that automatically chooses between ## Core API -```rust +```rust,ignore let blocks = Blocks::new(&rpc_client, &reader); // Various range specifications @@ -27,7 +27,7 @@ for block in blocks.after(Some(last_known_hash))? { ... } ## Source Modes -```rust +```rust,ignore // Auto-select (default) let blocks = Blocks::new(&client, &reader); diff --git a/crates/brk_logger/README.md b/crates/brk_logger/README.md index 7d90a1567..c039d9951 100644 --- a/crates/brk_logger/README.md +++ b/crates/brk_logger/README.md @@ -15,7 +15,7 @@ Drop-in logging initialization that silences noisy dependencies (bitcoin, fjall, ## Core API -```rust +```rust,ignore brk_logger::init(Some(Path::new("app.log")))?; // Console + file brk_logger::init(None)?; // Console only @@ -26,7 +26,7 @@ brk_logger::register_hook(|msg| { ## Usage -```rust +```rust,ignore use log::info; fn main() -> std::io::Result<()> { diff --git a/crates/brk_mcp/README.md b/crates/brk_mcp/README.md index 6b3ee86a3..5562ca043 100644 --- a/crates/brk_mcp/README.md +++ b/crates/brk_mcp/README.md @@ -28,7 +28,7 @@ Expose BRK's query capabilities to AI assistants via the MCP standard. LLMs can ## Usage -```rust +```rust,ignore let mcp = MCP::new(&async_query); // The MCP server implements ServerHandler for use with rmcp diff --git a/crates/brk_mempool/DESIGN.md b/crates/brk_mempool/DESIGN.md index 8a14da9e4..3d441e3ec 100644 --- a/crates/brk_mempool/DESIGN.md +++ b/crates/brk_mempool/DESIGN.md @@ -15,7 +15,7 @@ Instead of rebuilding all projected blocks on every insert/remove: ### MempoolPackage -```rust +```rust,ignore enum MempoolPackage { /// Tx with no unconfirmed parents - can be mined independently Independent(MempoolEntry), @@ -44,7 +44,7 @@ enum MempoolPackage { ### ProjectedBlock -```rust +```rust,ignore struct ProjectedBlock { /// Packages sorted by fee rate (highest first) packages: Vec, @@ -218,7 +218,7 @@ New tx A' replaces A (same inputs, higher fee) When a tx is removed (confirmed), check all `Pending` entries: -```rust +```rust,ignore fn on_tx_removed(&mut self, txid: Txid) { let pending_to_update: Vec<_> = self.pending .iter() @@ -243,7 +243,7 @@ fn on_tx_removed(&mut self, txid: Txid) { ### Cascade Down (after insert causes overflow) -```rust +```rust,ignore fn cascade_down(&mut self, starting_block: usize) { let mut block_idx = starting_block; @@ -277,7 +277,7 @@ fn cascade_down(&mut self, starting_block: usize) { ### Cascade Up (after remove causes underflow) -```rust +```rust,ignore fn cascade_up(&mut self, starting_block: usize) { let mut block_idx = starting_block; @@ -328,7 +328,7 @@ Need to track: 3. `txid → Vec` - descendants waiting for this tx (Pending) 4. Per-block: sorted packages by fee rate -```rust +```rust,ignore struct MempoolState { /// All packages (Independent, Bundle, or Pending) packages: FxHashMap, @@ -422,7 +422,7 @@ Their solution: rebuild fast rather than update incrementally. ### Key Optimization: Ancestor Score -```rust +```rust,ignore ancestor_score = (tx.fee + sum(ancestor.fee)) / (tx.weight + sum(ancestor.weight)) ``` diff --git a/crates/brk_mempool/README.md b/crates/brk_mempool/README.md index 3f7e319c4..abb07ea33 100644 --- a/crates/brk_mempool/README.md +++ b/crates/brk_mempool/README.md @@ -16,7 +16,7 @@ Track mempool state, estimate transaction fees via projected block building, and ## Core API -```rust +```rust,ignore let mempool = Mempool::new(&rpc_client); // Start background sync loop diff --git a/crates/brk_query/README.md b/crates/brk_query/README.md index 02eeed39d..7e4940d6e 100644 --- a/crates/brk_query/README.md +++ b/crates/brk_query/README.md @@ -17,7 +17,7 @@ Query blocks, transactions, addresses, and 1000+ on-chain metrics through a unif ## Core API -```rust +```rust,ignore let query = Query::build(&reader, &indexer, &computer, Some(mempool)); // Current height @@ -54,7 +54,7 @@ let stats = query.address_stats(&address)?; ## Async Usage -```rust +```rust,ignore let async_query = AsyncQuery::build(&reader, &indexer, &computer, mempool); // Run blocking queries in thread pool @@ -64,6 +64,10 @@ let result = async_query.run(|q| q.block_info(height)).await; let height = async_query.inner().height(); ``` +## Recommended: mimalloc v3 + +Use [mimalloc v3](https://crates.io/crates/mimalloc) as the global allocator to reduce memory usage. + ## Built On - `brk_indexer` for raw indexed data diff --git a/crates/brk_reader/README.md b/crates/brk_reader/README.md index a5c4c0c05..127b99161 100644 --- a/crates/brk_reader/README.md +++ b/crates/brk_reader/README.md @@ -17,7 +17,7 @@ Stream blocks directly from Bitcoin Core's `blk*.dat` files with parallel parsin ## Core API -```rust +```rust,ignore let reader = Reader::new(blocks_dir, &rpc_client); // Stream blocks from height 800,000 to 850,000 diff --git a/crates/brk_rpc/README.md b/crates/brk_rpc/README.md index 6a4cd3e48..9bbf9ce4d 100644 --- a/crates/brk_rpc/README.md +++ b/crates/brk_rpc/README.md @@ -17,7 +17,7 @@ Query a Bitcoin Core node for blocks, transactions, mempool data, and chain stat ## Core API -```rust +```rust,ignore let client = Client::new("http://localhost:8332", Auth::CookieFile(cookie_path))?; let height = client.get_last_height()?; diff --git a/crates/brk_server/README.md b/crates/brk_server/README.md index 49ade0c61..7635e9b0e 100644 --- a/crates/brk_server/README.md +++ b/crates/brk_server/README.md @@ -17,7 +17,7 @@ Serve BRK data via REST API with OpenAPI documentation, response caching, MCP en ## Core API -```rust +```rust,ignore let server = Server::new(&async_query, Some(files_path)); server.serve(true).await?; // true enables MCP endpoint ``` @@ -45,6 +45,10 @@ Uses ETag-based caching with stale-while-revalidate semantics: Server binds to port 3110 by default, auto-incrementing if busy (up to 3210). +## Recommended: mimalloc v3 + +Use [mimalloc v3](https://crates.io/crates/mimalloc) as the global allocator to reduce memory usage. + ## Built On - `brk_query` for data access diff --git a/crates/brk_store/README.md b/crates/brk_store/README.md index a4a5a242a..bcb071dc2 100644 --- a/crates/brk_store/README.md +++ b/crates/brk_store/README.md @@ -16,7 +16,7 @@ Persist and query Bitcoin index data (address→outputs, txid→height, etc.) wi ## Core API -```rust +```rust,ignore let store: Store = Store::import( &db, &path, "txid_to_height", Version::new(1), Mode::default(), Kind::Random diff --git a/crates/brk_traversable/README.md b/crates/brk_traversable/README.md index c673a7e23..4699d8ca8 100644 --- a/crates/brk_traversable/README.md +++ b/crates/brk_traversable/README.md @@ -16,7 +16,7 @@ Traverse nested data collections (datasets, grouped metrics) as trees for inspec ## Core API -```rust +```rust,ignore pub trait Traversable { fn to_tree_node(&self) -> TreeNode; fn iter_any_exportable(&self) -> impl Iterator; diff --git a/crates/brk_traversable_derive/README.md b/crates/brk_traversable_derive/README.md index 56737e74e..be90041b7 100644 --- a/crates/brk_traversable_derive/README.md +++ b/crates/brk_traversable_derive/README.md @@ -16,7 +16,7 @@ Automatically generate tree traversal and export iteration for structs, eliminat ## Core API -```rust +```rust,ignore #[derive(Traversable)] struct MyData { pub metrics: MetricsCollection, diff --git a/crates/brk_types/README.md b/crates/brk_types/README.md index b5b58c748..8ceba77e3 100644 --- a/crates/brk_types/README.md +++ b/crates/brk_types/README.md @@ -32,7 +32,7 @@ Work with Bitcoin primitives (heights, satoshis, addresses, transactions) throug All types implement standard traits: `Debug`, `Clone`, `Serialize`, `Deserialize`, plus domain-specific operations like `CheckedSub`, `Formattable`, and `PrintableIndex`. -```rust +```rust,ignore use brk_types::{Height, Sats, DateIndex, Date}; let height = Height::new(840_000);