diff options
| -rw-r--r-- | ttt.jai | 90 |
1 files changed, 62 insertions, 28 deletions
@@ -465,27 +465,22 @@ update_total_times :: (db: *Database) { // totals.data = .[]; // TODO WIP - Check what size there is for a [..] s64... + // Check what size there is for a [..] s64... print(">>%<<", db.total_times.count); // memset(totals.data, 0, db.total_times.count * size_of(s64)); // memset(db.total_times.data, 0, size_of(type_of(db.total_times))); - for xpto: 1..20 { + for xpto: 1..50 { start := current_time_monotonic(); for * total : db.total_times { <<total = 0; } - // 24ms - // for db.tasks { - // times : []s64 = it.times; - // for *total: db.total_times { - // <<total = add(<<total, times[it_index]); - // } - // } - - // 10ms + // ns/entry + // LLVM 14.5 + // X64 132.4 + // // totals: []s64 = db.total_times; // for db.tasks { // times : []s64 = it.times; @@ -498,7 +493,46 @@ update_total_times :: (db: *Database) { // totals[6] = add(totals[6], times[6]); // } - // 21ms + + // ns/entry + // LLVM 11.2 + // X64 119.9 + // + for db.tasks { + for *total: db.total_times { + <<total = add(<<total, it.times[it_index]); + } + } + + + // ns/entry + // LLVM 11.5 + // X64 126.6 + // + // for db.tasks { + // times : []s64 = it.times; + // for *total: db.total_times { + // <<total = add(<<total, times[it_index]); + // } + // } + + + // ns/entry + // LLVM 11.8 + // X64 134.4 + // + // totals: []s64 = db.total_times; + // for db.tasks { + // times : []s64 = it.times; + // for 0..totals.count-1 { + // totals[it] = add(totals[it], times[it]); + // } + // } + + // ns/entry + // LLVM 11.6 + // X64 132.3 + // // for db.tasks { // times : []s64 = it.times; // for 0..db.total_times.count-1 { @@ -506,30 +540,30 @@ update_total_times :: (db: *Database) { // } // } - unroll_week :: (code: string) -> string { - builder: String_Builder; - defer reset(*builder); - for 0..6 { - print_to_builder(*builder, code, it); - } - return builder_to_string(*builder); - } - - totals: []s64 = db.total_times; - for db.tasks { - times : []s64 = it.times; - #insert #run unroll_week("totals[%1] = add(totals[%1], times[%1]);"); - } + // unroll_week :: (code: string) -> string { + // builder: String_Builder; + // defer reset(*builder); + // for 0..6 { + // print_to_builder(*builder, code, it); + // } + // return builder_to_string(*builder); + // } +// + // totals: []s64 = db.total_times; + // for db.tasks { + // times : []s64 = it.times; + // #insert #run unroll_week("totals[%1] = add(totals[%1], times[%1]);"); + // } stop := current_time_monotonic(); - average: float64 = xx to_microseconds(stop-start); + average: float64 = xx to_nanoseconds(stop-start); x_average = (average + x_count * x_average) / (x_count + 1); x_count += 1; } - print("Measured % us.\n", x_average); + print("Measured % ns/entry.\n", x_average/(cast(float64)db.tasks.count)); } // Resets the times of the provided task (and adjusts database totals). |
