Skip to content

Commit

Permalink
366bps -> 499bps (boards/second). Move from uint to uint8_t
Browse files Browse the repository at this point in the history
  • Loading branch information
Jumbub committed Oct 15, 2021
1 parent 3ceb86f commit 644b7a9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
10 changes: 5 additions & 5 deletions results/benchmark.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------------------------------------------------
BM_NextBoard/iterations:3000/process_time/real_time 2.00 ms 7.47 ms 3000
BM_RenderBoard/process_time/real_time 9.56 ms 9.54 ms 67
Renders per second: 31.19
Boards per second: 366.941
BM_Main/iterations:1/repeats:1/process_time/real_time 5.45 s 18.0 s 1
BM_NextBoard/iterations:3000/process_time/real_time 1.49 ms 5.46 ms 3000
BM_RenderBoard/process_time/real_time 8.58 ms 8.56 ms 73
Renders per second: 31.1896
Boards per second: 499.033
BM_Main/iterations:1/repeats:1/process_time/real_time 4.01 s 12.4 s 1
9 changes: 6 additions & 3 deletions src/board/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
#include "threads.h"

using uint = unsigned int;
using Cell = uint;

using Cell = uint8_t;
[[maybe_unused]] const Cell ALIVE = 1;
[[maybe_unused]] const Cell ALIVE_RENDER = UINT32_MAX;
[[maybe_unused]] const Cell DEAD = 0;
[[maybe_unused]] const Cell DEAD_RENDER = 0;

using RenderCell = uint;
[[maybe_unused]] const RenderCell ALIVE_RENDER = UINT32_MAX;
[[maybe_unused]] const RenderCell DEAD_RENDER = 0;

struct BoardMeta {
uint width;
Expand Down
2 changes: 1 addition & 1 deletion src/board/next.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void nextBoardSection(
const uint width,
const Cell* input,
Cell* output) {
uint neighbours[3] = {0, 0, 0};
Cell neighbours[3] = {0, 0, 0};
uint nextYBase = 0;
uint middleYBase = 0;
uint lastYBase = 0;
Expand Down

0 comments on commit 644b7a9

Please sign in to comment.