-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to non-send Gc implementation to improve performance and simpl…
…ify code (#46) * Add benchmarks * Switch to non-send rwlock for gc to simplify code * Add bench * deep clone fix * Move cont clones back in line to improve clarity
- Loading branch information
Showing
22 changed files
with
546 additions
and
596 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use scheme_rs::{env::Env, lex::Token, syntax::ParsedSyntax}; | ||
|
||
use criterion::*; | ||
|
||
async fn fib() { | ||
let top = Env::top().await; | ||
|
||
let r6rs_tok = Token::tokenize_file(include_str!("fib.scm"), "fib.scm").unwrap(); | ||
let r6rs_sexprs = ParsedSyntax::parse(&r6rs_tok).unwrap(); | ||
for sexpr in r6rs_sexprs { | ||
sexpr | ||
.compile(&top, &None) | ||
.await | ||
.unwrap() | ||
.eval(&top, &None) | ||
.await | ||
.unwrap(); | ||
} | ||
} | ||
|
||
fn fib_benchmark(c: &mut Criterion) { | ||
c.bench_function("fib 100", |b| { | ||
b.to_async(tokio::runtime::Runtime::new().unwrap()) | ||
.iter(fib) | ||
}); | ||
} | ||
|
||
criterion_group!(benches, fib_benchmark); | ||
criterion_main!(benches); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
(define (fib n) | ||
(define (iter a b count) | ||
(if (<= count 0) | ||
a | ||
(iter b (+ a b) (- count 1)))) | ||
(iter 0 1 n)) | ||
|
||
(fib 100) |
This file contains 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
This file contains 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
Oops, something went wrong.