-
-
Save jeaye/2173da7851955ad13815862356cbfc6d to your computer and use it in GitHub Desktop.
jank object model final benchmark results
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
{ | |
ankerl::nanobench::Config config; | |
config.mMinEpochIterations = 1000000; | |
config.mOut = &std::cout; | |
config.mWarmup = 10000; | |
auto const kw_a(rt_ctx.intern_keyword("", "a", true)); | |
auto const kw_b(rt_ctx.intern_keyword("", "b", true)); | |
auto arr(jank::make_array_box<jank::runtime::object_ptr>(kw_a, kw_b)); | |
/* (let [arr (into-array Object [:a :b])] (quick-bench (clojure.lang.PersistentArrayMap/createAsIfByAssoc arr))) */ | |
ankerl::nanobench::Bench().config(config).run | |
( | |
"[after] map {:a :b}", | |
[&] | |
{ | |
auto const ret(jank::make_box<jank::runtime::obj::map>(jank::runtime::detail::in_place_unique{}, arr, 2)); | |
ankerl::nanobench::doNotOptimizeAway(ret); | |
} | |
); | |
auto const m(jank::make_box<jank::runtime::obj::map>(jank::runtime::detail::in_place_unique{}, arr, 2)); | |
/* (let [m {:a :b}] (quick-bench (get m :a))) */ | |
ankerl::nanobench::Bench().config(config).run | |
( | |
"[after] map get", | |
[&] | |
{ | |
auto const ret(jank::runtime::get(m, kw_a)); | |
ankerl::nanobench::doNotOptimizeAway(ret); | |
} | |
); | |
/* (quick-bench (clojure.lang.PersistentVector/create [:a :b :c])) */ | |
auto const kw_c(rt_ctx.intern_keyword("", "c", true)); | |
ankerl::nanobench::Bench().config(config).run | |
( | |
"[after] vector [:a :b :c]", | |
[&] | |
{ | |
auto const ret(jank::make_box<jank::runtime::obj::vector>(kw_a, kw_b, kw_c)); | |
ankerl::nanobench::doNotOptimizeAway(ret); | |
} | |
); | |
/* (let [v [:a :b :c]] (quick-bench (get v 1))) */ | |
auto const v(jank::make_box<jank::runtime::obj::vector>(kw_a, kw_b, kw_c)); | |
auto const one(jank::make_box(1)); | |
ankerl::nanobench::Bench().config(config).run | |
( | |
"[after] vector get", | |
[&] | |
{ | |
auto const ret(jank::runtime::get(v, one)); | |
ankerl::nanobench::doNotOptimizeAway(ret); | |
} | |
); | |
/* (quick-bench (String. "foo")) */ | |
ankerl::nanobench::Bench().config(config).run | |
( | |
"[after] short string", | |
[&] | |
{ | |
auto const ret(jank::make_box<jank::runtime::obj::string>("foo")); | |
ankerl::nanobench::doNotOptimizeAway(ret); | |
} | |
); | |
/* (quick-bench (String. "The Waystone Inn lay in silence, and it was a silence of three parts.")) */ | |
ankerl::nanobench::Bench().config(config).run | |
( | |
"[after] long string", | |
[&] | |
{ | |
auto const ret(jank::make_box<jank::runtime::obj::string>("The Waystone Inn lay in silence, and it was a silence of three parts.")); | |
ankerl::nanobench::doNotOptimizeAway(ret); | |
} | |
); | |
jank::runtime::object_ptr const num_555(jank::make_box(555.0)); | |
jank::runtime::object_ptr const num_777(jank::make_box(777.0)); | |
/* ((fn [a b] (quick-bench (- a b))) 555 777) */ | |
ankerl::nanobench::Bench().config(config).run | |
( | |
"[after] boxed sub", | |
[&] | |
{ | |
auto const ret(jank::runtime::sub(num_555, num_777)); | |
ankerl::nanobench::doNotOptimizeAway(ret); | |
} | |
); | |
/* ((fn [a] (let [b 777.0] (quick-bench (- a b)))) 555.0) */ | |
ankerl::nanobench::Bench().config(config).run | |
( | |
"[after] half boxed sub", | |
[&] | |
{ | |
auto const ret(jank::runtime::sub(num_555, 777.0)); | |
ankerl::nanobench::doNotOptimizeAway(ret); | |
} | |
); | |
/* (let [a 555.0 b 777.0] (quick-bench (- a b))) */ | |
ankerl::nanobench::Bench().config(config).run | |
( | |
"[after] unboxed sub", | |
[&] | |
{ | |
auto const ret(jank::runtime::sub(555.0, 777.0)); | |
ankerl::nanobench::doNotOptimizeAway(ret); | |
} | |
); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment