This file contains hidden or 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
| //! # mini-jsongrep — a teaching implementation of the jsongrep pipeline | |
| //! | |
| //! This single file is a deliberately tiny, dependency-free re-implementation | |
| //! of how `jsongrep` matches a path-query against a JSON document. It exists | |
| //! to teach the five-stage pipeline that the real crate uses: | |
| //! | |
| //! 1. **Parse JSON into a tree.** (Here we hand-build a `Json` enum. The real | |
| //! crate uses `serde_json_borrow` to parse text *zero-copy*.) | |
| //! 2. **Parse the query string into an AST** (`parse` -> `Query`). | |
| //! 3. **Compile the AST into an NFA** via *Glushkov's construction* |
This file contains hidden or 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
| wt() { | |
| # branch name | |
| local name="$1" | |
| # base branch for new worktrees | |
| local base="${2:-main}" | |
| # branch name with / replaced by - for use in directory name | |
| local safe_name="${name//\//-}" | |
| # current directory name; strip existing worktree suffix to get base repo name (uses _ as delimiter) | |
| local repo_name="${PWD##*/}" | |
| repo_name="${repo_name%%_*}" |
This file contains hidden or 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
| wt() { | |
| # branch name | |
| local name="$1" | |
| # base branch for new worktrees | |
| local base="${2:-main}" | |
| # branch name with / replaced by - for use in directory name | |
| local safe_name="${name//\//-}" | |
| # current directory name; strip existing worktree suffix to get base repo name (uses _ as delimiter) | |
| local repo_name="${PWD##*/}" | |
| repo_name="${repo_name%%_*}" |
This file contains hidden or 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
| pub trait Ontology { | |
| type Parent; | |
| } | |
| pub trait IsA<T> {} | |
| /// Recursive blanket impl: `T` `is_a` `U` if `T`'s parent `is_a` `U` | |
| impl<T, U> IsA<U> for T | |
| where | |
| T: Ontology, |
This file contains hidden or 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
| struct Qrel { | |
| doc_id: String, | |
| score: u32, | |
| } | |
| fn parse_queries_jsonl( | |
| opt: SearchOptions, | |
| ) -> (Vec<VectorType>, Vec<Option<Struct>>, Vec<HashSet<KeyBytes>>) { | |
| let queries_file = File::open(&opt.queries).expect("Cannot open queries file"); | |
| let queries_reader = BufReader::new(queries_file); |
This file contains hidden or 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
| #[tokio::main] | |
| async fn main() -> Result<(), Box<dyn std::error::Error>> { | |
| let session = VortexSession::empty() | |
| .with::<ArraySession>() | |
| .with::<VortexMetrics>() | |
| .with::<LayoutSession>() | |
| .with::<RuntimeSession>(); | |
| vortex::file::register_default_encodings(&session); |
This file contains hidden or 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
| services: | |
| opensearch: | |
| image: opensearchproject/opensearch:3 | |
| container_name: opensearch-node | |
| environment: | |
| - discovery.type=single-node | |
| - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m" | |
| - DISABLE_INSTALL_DEMO_CONFIG=true | |
| - DISABLE_SECURITY_PLUGIN=true | |
| - OPENSEARCH_INITIAL_ADMIN_PASSWORD=correct-horse-battery-staple |
This file contains hidden or 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
| use std::{hint::black_box, time::Duration}; | |
| use criterion::{criterion_group, criterion_main, BatchSize, Criterion}; | |
| use roaring::RoaringBitmap; | |
| fn bench(c: &mut Criterion) { | |
| for size in [1_000, 10_000, 100_000, 1_000_000] { | |
| for sparsity in [0.001, 0.01, 0.1, 0.5, 1.0] { | |
| let mut group = c.benchmark_group(format!("size={size}, sparsity={sparsity}")); |
This file contains hidden or 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
| use std::{ | |
| collections::{BTreeMap, HashMap}, | |
| hint::black_box, | |
| time::Duration, | |
| }; | |
| use ahash::AHashMap; | |
| use criterion::{BatchSize, Criterion, Throughput, criterion_group, criterion_main}; | |
| use uuid::Uuid; |
This file contains hidden or 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
| use std::{ | |
| collections::HashMap, | |
| hash::{DefaultHasher, Hash, Hasher}, | |
| }; | |
| const DEFAULT_VNODE_COUNT: usize = 1024; | |
| struct VNode { | |
| vnode_id: u64, | |
| inode_id: usize, |
NewerOlder