diff --git a/results/benchmark.txt b/results/benchmark.txt index 338464c..c60c376 100644 --- a/results/benchmark.txt +++ b/results/benchmark.txt @@ -1,8 +1,8 @@ ------------------------------------------------------------------------------------------------ Benchmark Time CPU Iterations ------------------------------------------------------------------------------------------------ -BM_NextBoard/iterations:3000/process_time/real_time 4.01 ms 15.4 ms 3000 -BM_RenderBoard/process_time/real_time 8.66 ms 8.58 ms 72 -Renders per second: 31.1941 -Boards per second: 210.061 -BM_Main/iterations:1/repeats:1/process_time/real_time 9.52 s 34.6 s 1 +BM_NextBoard/iterations:3000/process_time/real_time 4.19 ms 16.1 ms 3000 +BM_RenderBoard/process_time/real_time 8.32 ms 8.09 ms 77 +Renders per second: 31.1944 +Boards per second: 201.254 +BM_Main/iterations:1/repeats:1/process_time/real_time 9.94 s 36.2 s 1 diff --git a/src/board/board.h b/src/board/board.h index 45abc36..a04aba8 100644 --- a/src/board/board.h +++ b/src/board/board.h @@ -17,13 +17,11 @@ using Cell = uint; struct BoardMeta { Cell* input = nullptr; Cell* output = nullptr; - Cell* render = nullptr; uint width; uint height; Cell* raw = nullptr; - Cell* rawRender = nullptr; uint threads = PROBABLY_OPTIMAL_THREAD_COUNT; uint microsPerRender = 32000; // 30fps @@ -34,9 +32,6 @@ struct BoardMeta { if (this->width * this->height != width * height) { delete[] raw; raw = nullptr; - - delete[] rawRender; - rawRender = nullptr; } this->width = width; @@ -52,10 +47,6 @@ struct BoardMeta { input = &raw[0]; output = &raw[size]; } - if (rawRender == nullptr) { - rawRender = new Cell[size]; - render = &rawRender[0]; - } } BoardMeta(const uint& width, const uint& height) { @@ -66,7 +57,6 @@ struct BoardMeta { ~BoardMeta() { delete[] raw; - delete[] rawRender; } private: diff --git a/src/board/generate.h b/src/board/generate.h index b6ab35c..7a19b9b 100644 --- a/src/board/generate.h +++ b/src/board/generate.h @@ -18,16 +18,16 @@ void benchmarkBoard(BoardMeta& board, unsigned int width, unsigned int height) { const unsigned int i = y * width + x; if (y > height / 2) { if (x < width / 2) - board.input[i] = board.render[i] = rand() % 2 ? ALIVE : DEAD; + board.input[i] = rand() % 2 ? ALIVE : DEAD; if (x >= width / 2) - board.input[i] = board.render[i] = (x / 8) % 2 != (y / 8) % 2 ? ALIVE : DEAD; + board.input[i] = (x / 8) % 2 != (y / 8) % 2 ? ALIVE : DEAD; } else { const unsigned int breederMarginY = (height / 2 - BREEDER_HEIGHT) / 2; const unsigned int breederY = y - breederMarginY; if (breederY > 0 && breederY < BREEDER_HEIGHT && x < BREEDER_WIDTH) { - board.input[i] = board.render[i] = BREEDER[breederY][x] ? ALIVE : DEAD; + board.input[i] = BREEDER[breederY][x] ? ALIVE : DEAD; } else { - board.input[i] = board.render[i] = DEAD; + board.input[i] = DEAD; } } }