mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-07 02:04:21 +01:00
The motivation behind implementing our own lock is to not depend on any
dependency as we should moving forward. This is a experiment for now as
a single test obviously is not enough but I believe this is the right
direction to on.
## benchmark tldr;
Execute benchmarks have a performance improvement around [1.78%, 7.5%]
which seems like it went okay as it was expected from removing
`pthread_mutex` calls.
## benchmarks before
```
Prepare `SELECT 1`/Limbo/SELECT 1
time: [575.63 ns 577.33 ns 580.07 ns]
change: [-1.3304% -0.8881% -0.4675%] (p = 0.00 < 0.05)
Change within noise threshold.
Prepare `SELECT * FROM users LIMIT 1`/Limbo/SELECT * FROM users LIMIT 1
time: [1.2070 µs 1.2114 µs 1.2166 µs]
change: [-0.8670% -0.4084% -0.0252%] (p = 0.06 > 0.05)
No change in performance detected.
Prepare `SELECT first_name, count(1) FROM users GROUP BY first_name HAVING count(1) > 1 ORDER BY cou...
time: [2.9845 µs 2.9895 µs 2.9951 µs]
change: [-3.0470% -2.6038% -2.1301%] (p = 0.00 < 0.05)
Performance has improved.
Prepare `SELECT first_name, count(1) FROM users GROUP BY first_name HAVING count(1) > 1 ORDER BY cou... #2
time: [1.6015 µs 1.6084 µs 1.6157 µs]
change: [-0.0676% +0.3850% +0.8704%] (p = 0.11 > 0.05)
No change in performance detected.
Execute `SELECT * FROM users LIMIT ?`/Limbo/1
time: [442.46 ns 446.72 ns 454.13 ns]
change: [+3.9744% +4.5337% +5.3357%] (p = 0.00 < 0.05)
Performance has regressed.
Execute `SELECT * FROM users LIMIT ?`/Limbo/10
time: [3.1722 µs 3.1850 µs 3.1980 µs]
change: [+7.1994% +7.7452% +8.2856%] (p = 0.00 < 0.05)
Performance has regressed.
Execute `SELECT * FROM users LIMIT ?`/Limbo/50
time: [14.976 µs 15.024 µs 15.078 µs]
change: [+5.7879% +6.2419% +6.7139%] (p = 0.00 < 0.05)
Performance has regressed.
Execute `SELECT * FROM users LIMIT ?`/Limbo/100
time: [29.834 µs 29.925 µs 30.024 µs]
change: [+4.6519% +5.0384% +5.4491%] (p = 0.00 < 0.05)
Performance has regressed.
Execute `SELECT 1`/Limbo
time: [45.135 ns 45.439 ns 45.763 ns]
change: [-0.4703% -0.0496% +0.3622%] (p = 0.81 > 0.05)
No change in performance detected.
```
## benchmarks after
```
Prepare `SELECT 1`/Limbo/SELECT 1
time: [585.61 ns 590.92 ns 596.49 ns]
change: [+0.5902% +1.1505% +1.7012%] (p = 0.00 < 0.05)
Change within noise threshold.
Prepare `SELECT * FROM users LIMIT 1`/Limbo/SELECT * FROM users LIMIT 1
time: [1.2061 µs 1.2090 µs 1.2119 µs]
change: [-0.2364% +0.0977% +0.4252%] (p = 0.57 > 0.05)
No change in performance detected.
Prepare `SELECT first_name, count(1) FROM users GROUP BY first_name HAVING count(1) > 1 ORDER BY cou...
time: [2.9854 µs 2.9893 µs 2.9936 µs]
change: [-0.5752% -0.2529% +0.0167%] (p = 0.09 > 0.05)
No change in performance detected.
Prepare `SELECT first_name, count(1) FROM users GROUP BY first_name HAVING count(1) > 1 ORDER BY cou... #2
time: [1.5853 µs 1.5983 µs 1.6108 µs]
change: [-2.3810% -1.7986% -1.2748%] (p = 0.00 < 0.05)
Performance has improved.
Execute `SELECT * FROM users LIMIT ?`/Limbo/1
time: [429.84 ns 431.34 ns 433.07 ns]
change: [-2.7721% -1.8504% -0.8738%] (p = 0.00 < 0.05)
Change within noise threshold.
Execute `SELECT * FROM users LIMIT ?`/Limbo/10
time: [2.9184 µs 2.9254 µs 2.9323 µs]
change: [-8.2377% -7.7816% -7.3373%] (p = 0.00 < 0.05)
Performance has improved.
Execute `SELECT * FROM users LIMIT ?`/Limbo/50
time: [14.190 µs 14.229 µs 14.271 µs]
change: [-6.2034% -5.7858% -5.3552%] (p = 0.00 < 0.05)
Performance has improved.
Execute `SELECT * FROM users LIMIT ?`/Limbo/100
time: [28.734 µs 28.856 µs 28.979 µs]
change: [-4.3640% -3.9462% -3.5492%] (p = 0.00 < 0.05)
Performance has improved.
Execute `SELECT 1`/Limbo
time: [43.144 ns 43.237 ns 43.326 ns]
change: [-4.9417% -4.5554% -4.2030%] (p = 0.00 < 0.05)
Performance has improved.
```
Closes #1120