mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Add LinkedList Operators and Update Tests (#2438)
* Add LinkedList Operators and Update Tests * add linkedlist printing and `@new` macros (single-line init and pool-capable) * add linkedlist node and reg iterator; comparisons w/ == * Fix benchmarks. Drop random access to the linked list using []. Only return a direct array view. --------- Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
This commit is contained in:
@@ -56,6 +56,7 @@ long cycle_stop @local;
|
||||
DString benchmark_log @local;
|
||||
bool benchmark_warming @local;
|
||||
uint this_iteration @local;
|
||||
bool benchmark_stop @local;
|
||||
|
||||
macro @start_benchmark()
|
||||
{
|
||||
@@ -69,6 +70,12 @@ macro @end_benchmark()
|
||||
cycle_stop = $$sysclock();
|
||||
}
|
||||
|
||||
macro @kill_benchmark(String format, ...)
|
||||
{
|
||||
@log_benchmark(format, $vasplat);
|
||||
benchmark_stop = true;
|
||||
}
|
||||
|
||||
macro @log_benchmark(msg, args...) => @pool()
|
||||
{
|
||||
if (benchmark_warming) return;
|
||||
@@ -133,6 +140,7 @@ fn bool run_benchmarks(BenchmarkUnit[] benchmarks)
|
||||
@start_benchmark(); // can be overridden by calls inside the unit's func
|
||||
|
||||
unit.func() @inline;
|
||||
if (benchmark_stop) return false;
|
||||
|
||||
if (benchmark_nano_seconds == (NanoDuration){}) @end_benchmark(); // only mark when it wasn't already by the unit.func
|
||||
|
||||
|
||||
Reference in New Issue
Block a user