Code-iX / Gibbon-Git-Server

Gibbon Git Server is a web application to manage and connect to your git repositories. Go to homepage for release and more info. Forked by Bonobo Git Server.
https://code-ix.github.io/Gibbon-Git-Server/
MIT License
3 stars 0 forks source link

Database switch to integer IDs #10

Open Matt-17 opened 2 days ago

Matt-17 commented 2 days ago

As SQLite does not support natively GUID and it does not add value to the project, I am thinking about dumping GUID and switching to normal int IDs.

As all current entities provide a unique name anyway, it would improve links when using name instead of GUID.

Also it might improve performance a bit. Need to figure out.

Matt-17 commented 2 days ago

Performance is slightly faster with int, but not too much for small amounts of rows.

| Method            | LoopCount | Mean         | Error      | StdDev      |
|------------------ |---------- |-------------:|-----------:|------------:|
| InsertWithIntKey  | 10        |     7.112 ms |  0.1388 ms |   0.1991 ms |
| InsertWithGuidKey | 10        |     8.675 ms |  0.1700 ms |   0.2088 ms |
| ReadWithIntKey    | 10        |     7.991 ms |  0.1463 ms |   0.1297 ms |
| ReadWithGuidKey   | 10        |     8.744 ms |  0.0950 ms |   0.0742 ms |
| InsertWithIntKey  | 100       |     8.301 ms |  0.0732 ms |   0.0572 ms |
| InsertWithGuidKey | 100       |    21.025 ms |  0.4004 ms |   0.3550 ms |
| ReadWithIntKey    | 100       |    16.963 ms |  0.2631 ms |   0.2197 ms |
| ReadWithGuidKey   | 100       |    38.034 ms |  1.3670 ms |   3.8780 ms |
| InsertWithIntKey  | 1000      |    34.016 ms |  0.2973 ms |   0.2482 ms |
| InsertWithGuidKey | 1000      |   178.831 ms |  2.1486 ms |   1.9047 ms |
| ReadWithIntKey    | 1000      |   113.994 ms |  2.1427 ms |   2.2004 ms |
| ReadWithGuidKey   | 1000      |   185.238 ms |  2.7975 ms |   2.3360 ms |
| InsertWithIntKey  | 10000     |   193.191 ms |  2.6402 ms |   2.4697 ms |
| InsertWithGuidKey | 10000     | 1,224.525 ms | 39.1860 ms | 115.5408 ms |
| ReadWithIntKey    | 10000     |   969.760 ms |  4.7132 ms |   4.4087 ms |
| ReadWithGuidKey   | 10000     | 1,428.488 ms | 27.4391 ms |  29.3595 ms |

With SingleOrDefault() instead of Find() it's even worse:

| Method            | LoopCount | Mean        | Error     | StdDev     |
|------------------ |---------- |------------:|----------:|-----------:|
| InsertWithIntKey  | 10        |    21.35 ms |  0.438 ms |   1.293 ms |
| InsertWithGuidKey | 10        |    22.92 ms |  0.431 ms |   0.442 ms |
| ReadWithIntKey    | 10        |    21.94 ms |  0.435 ms |   1.033 ms |
| ReadWithGuidKey   | 10        |    24.79 ms |  0.492 ms |   1.252 ms |
| InsertWithIntKey  | 100       |    21.87 ms |  0.455 ms |   1.312 ms |
| InsertWithGuidKey | 100       |    38.37 ms |  0.722 ms |   1.124 ms |
| ReadWithIntKey    | 100       |    29.53 ms |  0.588 ms |   1.398 ms |
| ReadWithGuidKey   | 100       |    47.37 ms |  0.944 ms |   1.602 ms |
| InsertWithIntKey  | 1000      |    34.55 ms |  0.688 ms |   1.405 ms |
| InsertWithGuidKey | 1000      |   164.80 ms |  3.274 ms |   2.556 ms |
| ReadWithIntKey    | 1000      |   102.04 ms |  2.017 ms |   3.426 ms |
| ReadWithGuidKey   | 1000      |   248.22 ms |  4.734 ms |   5.452 ms |
| InsertWithIntKey  | 10000     |   199.59 ms |  3.980 ms |   4.583 ms |
| InsertWithGuidKey | 10000     | 1,102.15 ms | 62.867 ms | 185.365 ms |
| ReadWithIntKey    | 10000     |   877.93 ms |  9.154 ms |   8.563 ms |
| ReadWithGuidKey   | 10000     | 2,201.62 ms | 35.472 ms |  33.180 ms |

Imho this adds another reason for switching to int.