added benchmarking and screenshots
All checks were successful
Linux arm64 / Build (push) Successful in 1m58s
All checks were successful
Linux arm64 / Build (push) Successful in 1m58s
This commit is contained in:
27
README.md
27
README.md
@@ -42,7 +42,14 @@ If you want to know more details about the generation of polyominoes, [check the
|
|||||||
|
|
||||||
### Screenshots
|
### Screenshots
|
||||||
|
|
||||||
// TODO when the game is finished //
|
Pentedecamino jumpscare
|
||||||
|

|
||||||
|
|
||||||
|
Pieces select screen
|
||||||
|

|
||||||
|
|
||||||
|
AutoRS demonstration
|
||||||
|

|
||||||
|
|
||||||
## Manual build
|
## Manual build
|
||||||
|
|
||||||
@@ -77,10 +84,26 @@ If for some reasons you wanna run the command line version (not updated):
|
|||||||
|
|
||||||
## Benchmarks
|
## Benchmarks
|
||||||
|
|
||||||
### n-polyominoes
|
### One-sided n-polyominoes
|
||||||
|
|
||||||
| n | Number | Generation | File storing | File retrieving | File size |
|
| n | Number | Generation | File storing | File retrieving | File size |
|
||||||
| - | - | - | - | - | - |
|
| - | - | - | - | - | - |
|
||||||
|
| 1 | 1 | 0s 0.005622ms | 0s 0.750955ms | 0s 0.014016ms | 2 bytes |
|
||||||
|
| 2 | 1 | 0s 0.005758ms | 0s 0.181323ms | 0s 0.012256ms | 3 bytes |
|
||||||
|
| 3 | 2 | 0s 0.017525ms | 0s 0.054497ms | 0s 0.006431ms | 8 bytes |
|
||||||
|
| 4 | 7 | 0s 0.050554ms | 0s 0.067617ms | 0s 0.010984ms | 35 bytes |
|
||||||
|
| 5 | 18 | 0s 0.191971ms | 0s 0.109905ms | 0s 0.021234ms | 108 bytes |
|
||||||
|
| 6 | 60 | 0s 0.651757ms | 0s 0.327465ms | 0s 0.04558ms | 420 bytes |
|
||||||
|
| 7 | 196 | 0s 3.38847ms | 0s 1.94434ms | 0s 0.258777ms | 1568 bytes |
|
||||||
|
| 8 | 704 | 0s 22.7411ms | 0s 10.0103ms | 0s 1.34813ms | 6336 bytes |
|
||||||
|
| 9 | 2500 | 0s 66.2949ms | 0s 20.6137ms | 0s 2.56374ms | 25000 bytes |
|
||||||
|
| 10 | 9189 | 0s 194.764ms | 0s 84.5884ms | 0s 9.64467ms | 101079 bytes |
|
||||||
|
| 11 | 33896 | 0s 759.182ms | 0s 378.494ms | 0s 44.1424ms | 406752 bytes |
|
||||||
|
| 12 | 126759 | 2s 709.277ms | 1s 530.34ms | 0s 155ms | 1647867 bytes |
|
||||||
|
| 13 | 476270 | 10s 668.308ms | 7s 395.512ms | 0s 765.601ms | 6667780 bytes |
|
||||||
|
| 14 | 1802312 | 45s 606.597ms | 32s 28.7977ms | 2s 919.653ms | 27034680 bytes |
|
||||||
|
|
||||||
|
_File storing includes normalizing and sorting all polyominoes before writing them to the file._
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
|
|||||||
BIN
doc/readme/big_piece.png
Normal file
BIN
doc/readme/big_piece.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
BIN
doc/readme/pieces_selection.png
Normal file
BIN
doc/readme/pieces_selection.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
BIN
doc/readme/rotations.gif
Normal file
BIN
doc/readme/rotations.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 779 KiB |
@@ -25,10 +25,8 @@ int main(int argc, char** argv) {
|
|||||||
// dev: generate files if it hasn't been done before, UI will NOT generate the files
|
// dev: generate files if it hasn't been done before, UI will NOT generate the files
|
||||||
//generateFilesForAllSizes(10);
|
//generateFilesForAllSizes(10);
|
||||||
|
|
||||||
benchmarking(15);
|
TextApp UI;
|
||||||
|
UI.run();
|
||||||
//TextApp UI;
|
|
||||||
//UI.run();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -207,36 +205,54 @@ void benchmarking(int max_size) {
|
|||||||
|
|
||||||
Generator gen;
|
Generator gen;
|
||||||
PiecesFiles pf;
|
PiecesFiles pf;
|
||||||
std::vector<Piece> pieces;
|
|
||||||
std::vector<int> convexPieces;
|
|
||||||
std::vector<int> holelessPieces;
|
|
||||||
std::vector<int> otherPieces;
|
|
||||||
|
|
||||||
for (int i = 1; i <= max_size; i++) {
|
for (int i = max_size; i <= max_size; i++) {
|
||||||
std::cout << "| " << i;
|
std::cout << "| " << i;
|
||||||
|
|
||||||
auto t1 = high_resolution_clock::now();
|
auto t1 = high_resolution_clock::now();
|
||||||
auto polyominoes = gen.generatePolyominoes(i);
|
std::vector<Polyomino> polyominoes = gen.generatePolyominoes(i);
|
||||||
auto t2 = high_resolution_clock::now();
|
auto t2 = high_resolution_clock::now();
|
||||||
duration<double, std::milli> ms_double = t2 - t1;
|
duration<double, std::milli> ms_double = t2 - t1;
|
||||||
std::cout << " | " << polyominoes.size();
|
std::cout << " | " << polyominoes.size();
|
||||||
|
std::flush(std::cout);
|
||||||
std::cout << " | " << (int) ms_double.count() / 1000 << "s " << std::fmod(ms_double.count(), 1000) << "ms ";
|
std::cout << " | " << (int) ms_double.count() / 1000 << "s " << std::fmod(ms_double.count(), 1000) << "ms ";
|
||||||
|
std::flush(std::cout);
|
||||||
|
|
||||||
t1 = high_resolution_clock::now();
|
t1 = high_resolution_clock::now();
|
||||||
pf.savePieces(i, polyominoes);
|
pf.savePieces(i, polyominoes);
|
||||||
t2 = high_resolution_clock::now();
|
t2 = high_resolution_clock::now();
|
||||||
ms_double = t2 - t1;
|
ms_double = t2 - t1;
|
||||||
std::cout << " | " << (int) ms_double.count() / 1000 << "s " << std::fmod(ms_double.count(), 1000) << "ms ";
|
std::cout << " | " << (int) ms_double.count() / 1000 << "s " << std::fmod(ms_double.count(), 1000) << "ms ";
|
||||||
|
std::flush(std::cout);
|
||||||
|
|
||||||
|
polyominoes.clear();
|
||||||
|
polyominoes.shrink_to_fit();
|
||||||
|
|
||||||
|
std::vector<Piece> pieces;
|
||||||
|
std::vector<int> convexPieces;
|
||||||
|
std::vector<int> holelessPieces;
|
||||||
|
std::vector<int> otherPieces;
|
||||||
|
|
||||||
t1 = high_resolution_clock::now();
|
t1 = high_resolution_clock::now();
|
||||||
pf.loadPieces(i, pieces, convexPieces, holelessPieces, otherPieces);
|
pf.loadPieces(i, pieces, convexPieces, holelessPieces, otherPieces);
|
||||||
t2 = high_resolution_clock::now();
|
t2 = high_resolution_clock::now();
|
||||||
ms_double = t2 - t1;
|
ms_double = t2 - t1;
|
||||||
std::cout << " | " << (int) ms_double.count() / 1000 << "s " << std::fmod(ms_double.count(), 1000) << "ms ";
|
std::cout << " | " << (int) ms_double.count() / 1000 << "s " << std::fmod(ms_double.count(), 1000) << "ms ";
|
||||||
|
std::flush(std::cout);
|
||||||
|
|
||||||
|
pieces.clear();
|
||||||
|
pieces.shrink_to_fit();
|
||||||
|
convexPieces.clear();
|
||||||
|
convexPieces.shrink_to_fit();
|
||||||
|
holelessPieces.clear();
|
||||||
|
holelessPieces.shrink_to_fit();
|
||||||
|
otherPieces.clear();
|
||||||
|
otherPieces.shrink_to_fit();
|
||||||
|
|
||||||
std::string filePath;
|
std::string filePath;
|
||||||
pf.getFilePath(i, filePath);
|
pf.getFilePath(i, filePath);
|
||||||
int fileSize = std::filesystem::file_size(filePath);
|
int fileSize = std::filesystem::file_size(filePath);
|
||||||
std::cout << " | " << fileSize << " bytes |" << std::endl;
|
std::cout << " | " << fileSize << " bytes |" << std::endl;
|
||||||
|
std::flush(std::cout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user