pub struct BatchParserBuilder { /* private fields */ }Implementations§
Source§impl BatchParserBuilder
impl BatchParserBuilder
pub fn limits(self, limits: ParserLimits) -> Self
Sourcepub fn cache_capacity(self, entries: usize, bytes: usize) -> Self
pub fn cache_capacity(self, entries: usize, bytes: usize) -> Self
Set FIFO cache payload bounds. Zero entries disables retention.
Examples found in repository?
examples/parser_guard_bench.rs (line 159)
153fn main() {
154 println!("workload,iterations,sources,elapsed_ns,ns_per_parse,digest");
155 for c in corpus() {
156 let digest = semantic_digest(&c.formulas);
157 let builder = BatchParser::builder();
158 let builder = if let Ok(entries) = std::env::var("BENCH_CACHE_ENTRIES") {
159 builder.cache_capacity(entries.parse().unwrap(), usize::MAX)
160 } else {
161 builder
162 };
163 let mut batch = builder.build();
164 // Warm allocator, code and the full working set. Pre-existing token
165 // cache warmup is retained intentionally to reveal eviction thrashing.
166 let unique = c.name == "batch_unique_stream";
167 let warm_count = if unique {
168 4096
169 } else {
170 c.formulas.len().max(4096)
171 };
172 for i in 0..warm_count {
173 let other = unique.then(|| format!("=X{i}+Y{i}*$C$1"));
174 let f = other
175 .as_deref()
176 .unwrap_or(&c.formulas[i % c.formulas.len()]);
177 consume(if c.batch {
178 batch.parse(f).unwrap()
179 } else {
180 parse(f).unwrap()
181 });
182 }
183 let start = Instant::now();
184 for i in 0..c.iterations {
185 let f = black_box(&c.formulas[i % c.formulas.len()]);
186 consume(if c.batch {
187 batch.parse(f).unwrap()
188 } else {
189 parse(f).unwrap()
190 });
191 }
192 let elapsed = start.elapsed().as_nanos();
193 println!(
194 "{},{},{},{},{:.3},{:016x}",
195 c.name,
196 c.iterations,
197 c.formulas.len(),
198 elapsed,
199 elapsed as f64 / c.iterations as f64,
200 digest
201 );
202 }
203}pub fn include_whitespace(self, include: bool) -> Self
pub fn with_volatility_classifier<F>(self, f: F) -> Self
pub fn dialect(self, dialect: FormulaDialect) -> Self
Sourcepub fn build(self) -> BatchParser
pub fn build(self) -> BatchParser
Examples found in repository?
examples/parser_guard_bench.rs (line 163)
153fn main() {
154 println!("workload,iterations,sources,elapsed_ns,ns_per_parse,digest");
155 for c in corpus() {
156 let digest = semantic_digest(&c.formulas);
157 let builder = BatchParser::builder();
158 let builder = if let Ok(entries) = std::env::var("BENCH_CACHE_ENTRIES") {
159 builder.cache_capacity(entries.parse().unwrap(), usize::MAX)
160 } else {
161 builder
162 };
163 let mut batch = builder.build();
164 // Warm allocator, code and the full working set. Pre-existing token
165 // cache warmup is retained intentionally to reveal eviction thrashing.
166 let unique = c.name == "batch_unique_stream";
167 let warm_count = if unique {
168 4096
169 } else {
170 c.formulas.len().max(4096)
171 };
172 for i in 0..warm_count {
173 let other = unique.then(|| format!("=X{i}+Y{i}*$C$1"));
174 let f = other
175 .as_deref()
176 .unwrap_or(&c.formulas[i % c.formulas.len()]);
177 consume(if c.batch {
178 batch.parse(f).unwrap()
179 } else {
180 parse(f).unwrap()
181 });
182 }
183 let start = Instant::now();
184 for i in 0..c.iterations {
185 let f = black_box(&c.formulas[i % c.formulas.len()]);
186 consume(if c.batch {
187 batch.parse(f).unwrap()
188 } else {
189 parse(f).unwrap()
190 });
191 }
192 let elapsed = start.elapsed().as_nanos();
193 println!(
194 "{},{},{},{},{:.3},{:016x}",
195 c.name,
196 c.iterations,
197 c.formulas.len(),
198 elapsed,
199 elapsed as f64 / c.iterations as f64,
200 digest
201 );
202 }
203}Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for BatchParserBuilder
impl !UnwindSafe for BatchParserBuilder
impl Freeze for BatchParserBuilder
impl Send for BatchParserBuilder
impl Sync for BatchParserBuilder
impl Unpin for BatchParserBuilder
impl UnsafeUnpin for BatchParserBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more