diff options
| author | dam <dam@gudinoff> | 2023-08-19 02:48:30 +0100 |
|---|---|---|
| committer | dam <dam@gudinoff> | 2023-08-19 02:48:30 +0100 |
| commit | c87ae97113883b39e2c05958d6a79891bec44bc4 (patch) | |
| tree | 3d903876e37667b0c62f0d77b7a25c73b5b03d80 /ttt.jai | |
| parent | f8080876d29be1241a59ef96c3ddb00bef84b60a (diff) | |
| download | task-time-tracker-c87ae97113883b39e2c05958d6a79891bec44bc4.tar.zst task-time-tracker-c87ae97113883b39e2c05958d6a79891bec44bc4.zip | |
Selected implementation for update_total_times.
Diffstat (limited to 'ttt.jai')
| -rw-r--r-- | ttt.jai | 92 |
1 files changed, 1 insertions, 91 deletions
@@ -448,107 +448,17 @@ update_times :: (db: *Database) { } } -x_count: s64 = 0; -x_average: float64 = 0.0; - - // Recalculates database totals. update_total_times :: (db: *Database) { assert(db != null, ASSERT_NOT_NULL, "db"); - // print(">>>xpto: %<<<\n", totals); - // print(">>>sizeA: %<<<\n", size_of([7] s64)); - // print(">>>sizeB: %<<<\n", NUM_WEEK_DAYS * size_of(s64)); - // print(">>>sizeC: %<<<\n", size_of(type_of(db.total_times))); - // Initialize(*totals.data); - // print(">>>xpto: %<<<\n", totals); - // totals.data = .[]; - - // TODO WIP - // 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..100 { + for *total: db.total_times { <<total = 0; } - start := current_time_monotonic(); - - for * total : db.total_times { <<total = 0; } - - // I5-2550K R3550H (ns/entry) - // LLVM 14.5 5.0 - // X64 132.4 124.4 - // - // totals: []s64 = db.total_times; - // for db.tasks { - // times : []s64 = it.times; - // totals[0] = add(totals[0], times[0]); - // totals[1] = add(totals[1], times[1]); - // totals[2] = add(totals[2], times[2]); - // totals[3] = add(totals[3], times[3]); - // totals[4] = add(totals[4], times[4]); - // totals[5] = add(totals[5], times[5]); - // totals[6] = add(totals[6], times[6]); - // } - - - // I5-2550K R3550H (ns/entry) - // LLVM 11.2 11.7 - // X64 118.2 124.5 - // for task: db.tasks { for *total, index: db.total_times { <<total = add(<<total, task.times[index]); } } - - - // I5-2550K R3550H (ns/entry) - // LLVM 11.5 12.1 - // X64 126.6 132.8 - // - // for db.tasks { - // times : []s64 = it.times; - // for *total: db.total_times { - // <<total = add(<<total, times[it_index]); - // } - // } - - - // I5-2550K R3550H (ns/entry) - // LLVM 11.6 11.2 - // X64 132.3 133.8 - // - // for db.tasks { - // times : []s64 = it.times; - // for 0..db.total_times.count-1 { - // db.total_times[it] = add(db.total_times[it], times[it]); - // } - // } - - - // I5-2550K R3550H (ns/entry) - // LLVM 11.8 10.2 - // X64 134.4 132.5 - // - // totals: []s64 = db.total_times; - // for db.tasks { - // times : []s64 = it.times; - // for 0..totals.count-1 { - // totals[it] = add(totals[it], times[it]); - // } - // } - - - stop := current_time_monotonic(); - average: float64 = xx to_nanoseconds(stop-start); - x_average = (average + x_count * x_average) / (x_count + 1); - x_count += 1; - } - - print("Measured % ns/entry.\n", x_average/(cast(float64)db.tasks.count)); } // Resets the times of the provided task (and adjusts database totals). |
