Skip to content

Commit

Permalink
Import third party collections and use internal Allocator API
Browse files Browse the repository at this point in the history
  • Loading branch information
udoprog committed Sep 23, 2023
1 parent e98eaca commit 1e28bf9
Show file tree
Hide file tree
Showing 194 changed files with 43,759 additions and 2,984 deletions.
9 changes: 7 additions & 2 deletions benches/benches/benchmarks/aoc_2020_19b.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use criterion::Criterion;

use rune::alloc::TryClone;

criterion::criterion_group!(benches, aoc_2020_19b);

const INPUT: &str = include_str!("data/aoc_2020_19b.txt");
Expand All @@ -8,7 +10,7 @@ fn aoc_2020_19b(b: &mut Criterion) {
let mut data = rune::runtime::Vec::new();

for line in INPUT.split('\n').filter(|s| !s.is_empty()) {
data.push(line.to_owned().into());
data.push(rune::to_value(line.to_owned()).unwrap()).unwrap();
}

let mut vm = rune_vm! {
Expand Down Expand Up @@ -234,6 +236,9 @@ fn aoc_2020_19b(b: &mut Criterion) {
let entry = rune::Hash::type_hash(["main"]);

b.bench_function("aoc_2020_19b", |b| {
b.iter(|| vm.call(entry, (data.clone(),)).expect("failed call"));
b.iter(|| {
vm.call(entry, (data.try_clone().unwrap(),))
.expect("failed call")
});
});
}
6 changes: 5 additions & 1 deletion benches/benches/benchmarks/aoc_2020_1a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use anyhow::Context;
use criterion::Criterion;
use rune::alloc::TryClone;

criterion::criterion_group!(benches, aoc_2020_1a);

Expand Down Expand Up @@ -86,6 +87,9 @@ fn aoc_2020_1a(b: &mut Criterion) {
let entry = rune::Hash::type_hash(["main"]);

b.bench_function("aoc_2020_1a", |b| {
b.iter(|| vm.call(entry, (data.clone(),)).expect("failed call"));
b.iter(|| {
vm.call(entry, (data.try_clone().unwrap(),))
.expect("failed call")
});
});
}
7 changes: 6 additions & 1 deletion benches/benches/benchmarks/aoc_2020_1b.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
use criterion::Criterion;

use rune::alloc::TryClone;

criterion::criterion_group!(benches, aoc_2020_1b);

const INPUT: &str = include_str!("data/aoc_2020_1.txt");
Expand Down Expand Up @@ -60,6 +62,9 @@ fn aoc_2020_1b(b: &mut Criterion) {
let entry = rune::Hash::type_hash(["main"]);

b.bench_function("aoc_2020_1b", |b| {
b.iter(|| vm.call(entry, (data.clone(),)).expect("failed call"));
b.iter(|| {
vm.call(entry, (data.try_clone().unwrap(),))
.expect("failed call")
});
});
}
1 change: 1 addition & 0 deletions crates/rune-alloc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/patches/
26 changes: 26 additions & 0 deletions crates/rune-alloc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "rune-alloc"
version = "0.12.3"
authors = ["John-John Tedro <[email protected]>"]
edition = "2021"
rust-version = "1.70"
description = "The Rune Language, an embeddable dynamic programming language for Rust."
documentation = "https://docs.rs/rune"
readme = "README.md"
homepage = "https://github.com/rune-rs/rune"
repository = "https://github.com/rune-rs/rune"
license = "MIT OR Apache-2.0"
keywords = ["language", "scripting", "scripting-language"]
categories = ["parser-implementations"]

[features]
default = ["std", "serde"]
std = ["alloc", "ahash/std"]
alloc = []

[dependencies]
serde = { version = "1.0", optional = true }
ahash = { version = "0.8.3", default-features = false }

[dev-dependencies]
rand = { version = "0.8.5", features = ["small_rng"] }
Loading

0 comments on commit 1e28bf9

Please sign in to comment.