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 170)
164fn main() {
165 println!("workload,iterations,sources,elapsed_ns,ns_per_parse,digest");
166 for c in corpus() {
167 let digest = semantic_digest(&c.formulas);
168 let builder = BatchParser::builder();
169 let builder = if let Ok(entries) = std::env::var("BENCH_CACHE_ENTRIES") {
170 builder.cache_capacity(entries.parse().unwrap(), usize::MAX)
171 } else {
172 builder
173 };
174 let mut batch = builder.build();
175 // Warm allocator, code and the full working set. Pre-existing token
176 // cache warmup is retained intentionally to reveal eviction thrashing.
177 let unique = c.name == "batch_unique_stream";
178 let warm_count = if unique {
179 4096
180 } else {
181 c.formulas.len().max(4096)
182 };
183 for i in 0..warm_count {
184 let other = unique.then(|| format!("=X{i}+Y{i}*$C$1"));
185 let f = other
186 .as_deref()
187 .unwrap_or(&c.formulas[i % c.formulas.len()]);
188 consume(if c.batch {
189 batch.parse(f).unwrap()
190 } else {
191 parse(f).unwrap()
192 });
193 }
194 let start = Instant::now();
195 for i in 0..c.iterations {
196 let f = black_box(&c.formulas[i % c.formulas.len()]);
197 consume(if c.batch {
198 batch.parse(f).unwrap()
199 } else {
200 parse(f).unwrap()
201 });
202 }
203 let elapsed = start.elapsed().as_nanos();
204 println!(
205 "{},{},{},{},{:.3},{:016x}",
206 c.name,
207 c.iterations,
208 c.formulas.len(),
209 elapsed,
210 elapsed as f64 / c.iterations as f64,
211 digest
212 );
213 }
214}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 174)
164fn main() {
165 println!("workload,iterations,sources,elapsed_ns,ns_per_parse,digest");
166 for c in corpus() {
167 let digest = semantic_digest(&c.formulas);
168 let builder = BatchParser::builder();
169 let builder = if let Ok(entries) = std::env::var("BENCH_CACHE_ENTRIES") {
170 builder.cache_capacity(entries.parse().unwrap(), usize::MAX)
171 } else {
172 builder
173 };
174 let mut batch = builder.build();
175 // Warm allocator, code and the full working set. Pre-existing token
176 // cache warmup is retained intentionally to reveal eviction thrashing.
177 let unique = c.name == "batch_unique_stream";
178 let warm_count = if unique {
179 4096
180 } else {
181 c.formulas.len().max(4096)
182 };
183 for i in 0..warm_count {
184 let other = unique.then(|| format!("=X{i}+Y{i}*$C$1"));
185 let f = other
186 .as_deref()
187 .unwrap_or(&c.formulas[i % c.formulas.len()]);
188 consume(if c.batch {
189 batch.parse(f).unwrap()
190 } else {
191 parse(f).unwrap()
192 });
193 }
194 let start = Instant::now();
195 for i in 0..c.iterations {
196 let f = black_box(&c.formulas[i % c.formulas.len()]);
197 consume(if c.batch {
198 batch.parse(f).unwrap()
199 } else {
200 parse(f).unwrap()
201 });
202 }
203 let elapsed = start.elapsed().as_nanos();
204 println!(
205 "{},{},{},{},{:.3},{:016x}",
206 c.name,
207 c.iterations,
208 c.formulas.len(),
209 elapsed,
210 elapsed as f64 / c.iterations as f64,
211 digest
212 );
213 }
214}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