diff --git a/src/engines/answer/calc.rs b/src/engines/answer/calc.rs index d1700d1..c7f82c4 100644 --- a/src/engines/answer/calc.rs +++ b/src/engines/answer/calc.rs @@ -1,4 +1,4 @@ -use std::{cell::Cell, sync::LazyLock, time::Instant}; +use std::{cell::Cell, sync::LazyLock}; use fend_core::SpanKind; @@ -194,9 +194,12 @@ fn evaluate_into_spans(query: &str, multiline: bool) -> Vec { context.set_output_mode_terminal(); } - // not a perfect anti-abuse but good enough for our purposes + // avoids stackoverflows and queries that take too long + // examples: + // - Y = (\f. (\x. f x x)) (\x. f x x); Y(Y) + // - 10**100000000 let interrupt = Interrupter { - invocations_left: Cell::new(10000), + invocations_left: Cell::new(1000), }; let Ok(result) = fend_core::evaluate_with_interrupt(query, &mut context, &interrupt) else { return vec![]; diff --git a/src/engines/mod.rs b/src/engines/mod.rs index ef681b3..0338763 100644 --- a/src/engines/mod.rs +++ b/src/engines/mod.rs @@ -72,7 +72,7 @@ impl Engine { Engine::Google => 1.05, Engine::Bing => 1., Engine::Brave => 1.25, - Engine::Marginalia => 0.3, + Engine::Marginalia => 0.15, _ => 1., } }