From 17b78f8cb127817b93f7e6ced7e55d8748806a80 Mon Sep 17 00:00:00 2001 From: Sophie Forrest Date: Fri, 30 Aug 2024 23:35:45 +1200 Subject: feat: bar engines behind features, optimise release and small profiles --- src/lib.rs | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 2c40797..71c5a99 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -88,6 +88,7 @@ pub mod parser; #[cfg(feature = "utilities")] pub mod utility; +pub use executor::{U16 as ExecutorU16, U32 as ExecutorU32, U8 as ExecutorU8}; pub use lexer::{lex, OperatorCode}; use miette::Diagnostic; pub use parser::{parse, Instruction}; @@ -152,8 +153,11 @@ mod tests { let mut tape: Vec = vec![0; 1024]; #[allow(clippy::expect_used)] - utility::execute_from_file::("./test_programs/hello_world.bf", &mut tape) - .expect("failed to run"); + utility::execute_from_file::( + "./test_programs/hello_world_from_hell.bf", + &mut tape, + ) + .expect("failed to run"); }); } @@ -164,7 +168,21 @@ mod tests { #[allow(clippy::expect_used)] utility::execute_from_file::( - "./test_programs/hello_world.bf", + "./test_programs/hello_world_from_hell.bf", + &mut tape, + ) + .expect("failed to run"); + }); + } + + #[bench] + fn hello_world_from_hell_bench_u32(b: &mut Bencher) { + b.iter(|| { + let mut tape: Vec = vec![0; 1024]; + + #[allow(clippy::expect_used)] + utility::execute_from_file::( + "./test_programs/hello_world_from_hell.bf", &mut tape, ) .expect("failed to run"); -- cgit 1.4.1