C CASTLE / PERFORMANCE NOTES
CASTLE/Benchmarks

PERFORMANCE / FIELD RESULTS

Benchmarks

A captured comparison of CASTLE and STL operations.

Open the original Markdown log ↗

How to read this run

No reliable overall winner

Among the more plausible rows, CASTLE and STL are often close, with some operation-specific differences in both directions. This run is best treated as an initial signal, not as evidence that either implementation is universally faster.

  • CASTLE leadsThe visible results favor CASTLE for several hash/tree insert and erase cases, string search, array access, and bitset string conversion. These are individual results, not a general guarantee.
  • STL leadsThe visible results favor STL for string construction and substring search, and for the queue push/pop case. Other common operations are close in this run.
  • Mostly comparableMany measured operations show similar times, especially basic chrono, utility, and vector operations. Several displayed sub-nanosecond values are too close to the measurement floor for a confident ranking.

Measurement warning. Many rows report only one iteration alongside implausibly large elapsed times; the benchmark harness has timing-pause placement issues in affected cases. Some extremely small times are also vulnerable to optimizer elimination and timer resolution. Treat those rows as invalid for ranking. For a defensible comparison, rerun corrected benchmarks with observable results, repeated samples, and the intended target hardware.

Comparison charts

Charts cover the 28 CASTLE/STL pairs with a valid timing in this run. The other 51 pairs are listed in the results table with the reason they were excluded.

Speed ratio per valid pair

CASTLE faster Parity (±3%) STL faster

Callbacks

inplace_function_call
1.03x
inplace_function_construct
1.00x

Chrono

steady_clock_now
1.05x
system_clock_now
1.02x

Containers

array_access
1.31x
vector_push_back
1.00x
vector_emplace_back
1.03x
vector_pop_back
1.02x
vector_clear
1.00x
hash_map_insert
1.26x
hash_map_erase
1.26x
hash_set_insert
1.32x
hash_set_erase
1.25x
tree_map_insert
1.18x
tree_map_erase
1.28x
tree_set_insert
1.17x
tree_set_erase
1.28x
stack_push_pop
1.00x
queue_push_pop
0.95x

Strings

string_construct
0.94x
string_append
1.01x
string_compare_equal
1.00x
string_find
2.11x
string_view_find_substring
0.97x

Events

event_register
1.03x
inplace_event_register
1.00x
signal_connect_disconnect
1.02x

Utility

bitset_to_string
1.26x

STL ÷ CASTLE, CPU ns per op. Bar scale 0–2.25x. Vertical line marks 1.00x (parity).

Outcome counts by category

CASTLE faster Parity STL faster
Callbacks (2)
0 / 2 / 0
Chrono (2)
1 / 1 / 0
Containers (15)
9 / 5 / 1
Strings (5)
1 / 3 / 1
Events (3)
0 / 3 / 0
Utility (1)
1 / 0 / 0
All valid pairs (28)
12 / 14 / 2

Values are CASTLE faster / parity / STL faster. Bar width is the share of pairs in each category.

Full results table

CPU time per operation from the captured run, in ns. Ratio = STL ÷ CASTLE. "1 iteration" rows have invalid timing (see the measurement warning). "Loop floor" rows are at or below 0.25 ns, where the work is likely optimized away or limited by timer resolution.

BenchmarkCASTLE CPU (ns)STL CPU (ns)STL ÷ CASTLEStatus
Algorithms
algorithm_find22802952330118n/aExcluded: 1 iteration
algorithm_sort23554252386553n/aExcluded: 1 iteration
algorithm_transform24146252464859n/aExcluded: 1 iteration
algorithm_lower_bound25009972525663n/aExcluded: 1 iteration
Callbacks
function_free_call0.1971.01n/aExcluded: loop floor
function_compile_time_call0.1970.197n/aExcluded: loop floor
function_functor_call0.1970.866n/aExcluded: loop floor
function_member_call0.1970.197n/aExcluded: loop floor
inplace_function_call0.8700.8921.03xParity
inplace_function_construct1.011.011.00xParity
Chrono
duration_add0.1970.197n/aExcluded: loop floor
duration_cast0.1970.197n/aExcluded: loop floor
duration_update36826622823682676639n/aExcluded: 1 iteration
time_point_add0.1970.197n/aExcluded: loop floor
time_point_compare0.1970.197n/aExcluded: loop floor
time_point_difference0.1970.197n/aExcluded: loop floor
steady_clock_now17.017.81.05xCASTLE faster
system_clock_now17.117.51.02xParity
Containers
array_construct0.1970.197n/aExcluded: loop floor
array_access19.125.11.31xCASTLE faster
vector_construct0.1975.42n/aExcluded: loop floor
vector_push_back7947941.00xParity
vector_emplace_back7958151.03xParity
vector_pop_back7898081.02xParity
vector_clear7197221.00xParity
hash_map_insert86410851.26xCASTLE faster
hash_map_find_hit2.0788e+102.0788e+10n/aExcluded: 1 iteration
hash_map_find_miss2.0788e+102.0788e+10n/aExcluded: 1 iteration
hash_map_erase85710801.26xCASTLE faster
hash_set_insert86511411.32xCASTLE faster
hash_set_contains2.7139e+102.7140e+10n/aExcluded: 1 iteration
hash_set_erase85510721.25xCASTLE faster
tree_map_insert130615461.18xCASTLE faster
tree_map_find3.3366e+103.3366e+10n/aExcluded: 1 iteration
tree_map_lower_bound3.3366e+103.3366e+10n/aExcluded: 1 iteration
tree_map_erase111014251.28xCASTLE faster
tree_set_insert128315051.17xCASTLE faster
tree_set_find3.9973e+103.9973e+10n/aExcluded: 1 iteration
tree_set_lower_bound3.9973e+103.9973e+10n/aExcluded: 1 iteration
tree_set_erase111414271.28xCASTLE faster
stack_push_pop9319351.00xParity
stack_top6.2858e+106.2858e+10n/aExcluded: 1 iteration
queue_push_pop9268790.95xSTL faster
queue_front6.5763e+106.5763e+10n/aExcluded: 1 iteration
Strings
string_construct14.713.80.94xSTL faster
string_append7237321.01xParity
string_compare_equal1.631.631.00xParity
string_find4.008.432.11xCASTLE faster
string_view_construct0.1980.198n/aExcluded: loop floor
string_view_find0.1970.197n/aExcluded: loop floor
string_view_find_substring3.843.740.97xParity
string_view_compare0.1970.197n/aExcluded: loop floor
Events
event_dispatch26674342770425n/aExcluded: 1 iteration
event_register7127311.03xParity
inplace_event_dispatch31381532803138167959n/aExcluded: 1 iteration
inplace_event_register7177201.00xParity
signal_emit63178325946317847931n/aExcluded: 1 iteration
signal_connect_disconnect7147311.02xParity
Iterator
iterator_distance27305942759599n/aExcluded: 1 iteration
iterator_advance27674842774666n/aExcluded: 1 iteration
iterator_next28137892826884n/aExcluded: 1 iteration
Math
math_abs0.1970.197n/aExcluded: loop floor
math_sqrt0.1970.197n/aExcluded: loop floor
math_clamp0.1970.197n/aExcluded: loop floor
math_is_power_of_two0.1970.197n/aExcluded: loop floor
math_fib0.1974.24n/aExcluded: loop floor
math_mean0.1970.197n/aExcluded: loop floor
Utility
bitset_set_reset0.1970.197n/aExcluded: loop floor
bitset_count0.1970.197n/aExcluded: loop floor
bitset_test0.1960.197n/aExcluded: loop floor
bitset_to_ullong0.1970.197n/aExcluded: loop floor
bitset_to_string50.263.11.26xCASTLE faster
pair_construct0.1970.198n/aExcluded: loop floor
pair_get0.1970.197n/aExcluded: loop floor
pair_compare0.1970.197n/aExcluded: loop floor
variant_construct0.1970.197n/aExcluded: loop floor
variant_emplace1.6229e+101.6229e+10n/aExcluded: 1 iteration
variant_get0.1970.197n/aExcluded: loop floor
variant_visit0.1970.197n/aExcluded: loop floor

Reminder: CASTLE was created not to compete in performance, but rather to fulfill a mandate for absolute deterministic behavior, explicit failure reporting, fixed-capacity storage and zero dynamic allocation.