Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cpu: subtract sample time from parent call stack (#72)
We misinterpreted the way pprof uses the sample time, and the test programs we used had too shallow or too similar stack traces to highlight the issue. Too much time was accounted in `main` because we didn't subtract the time spent in sub-stacks. pprof also miscalculated the total profile time, reporting 45s on a test that lasted for ~4s. With this fix, the profile looks a lot more accurate, and the total profile time also closely matches the test runtime. ``` Benchmark_speedtest1 20 234045385 ns/op 1164882 B/op 355 allocs/op PASS -- Speedtest1 for SQLite 3.41.2 2023-03-22 11:56:21 0d1fc92f94cb6b76bffe3ec34d69 100 - 10000 INSERTs into table with no index...................... 0.073s 110 - 10000 ordered INSERTS with one index/PK..................... 0.120s 120 - 10000 unordered INSERTS with one index/PK................... 0.128s 130 - 25 SELECTS, numeric BETWEEN, unindexed...................... 0.091s 140 - 10 SELECTS, LIKE, unindexed................................. 0.148s 142 - 10 SELECTS w/ORDER BY, unindexed............................ 0.204s 145 - 10 SELECTS w/ORDER BY and LIMIT, unindexed.................. 0.129s 150 - CREATE INDEX five times..................................... 0.169s 160 - 2000 SELECTS, numeric BETWEEN, indexed...................... 0.079s 161 - 2000 SELECTS, numeric BETWEEN, PK........................... 0.081s 170 - 2000 SELECTS, text BETWEEN, indexed......................... 0.175s 180 - 10000 INSERTS with three indexes............................ 0.160s 190 - DELETE and REFILL one table................................. 0.162s 200 - VACUUM...................................................... 0.145s 210 - ALTER TABLE ADD COLUMN, and query........................... 0.008s 230 - 2000 UPDATES, numeric BETWEEN, indexed...................... 0.048s 240 - 10000 UPDATES of individual rows............................ 0.094s 250 - One big UPDATE of the whole 10000-row table................. 0.022s 260 - Query added column after filling............................ 0.007s 270 - 2000 DELETEs, numeric BETWEEN, indexed...................... 0.104s 280 - 10000 DELETEs of individual rows............................ 0.096s 290 - Refill two 10000-row tables using REPLACE................... 0.428s 300 - Refill a 10000-row table using (b&1)==(a&1)................. 0.180s 310 - 2000 four-ways joins........................................ 0.278s 320 - subquery in result set...................................... 0.262s 400 - 14000 REPLACE ops on an IPK................................. 0.143s 410 - 14000 SELECTS on an IPK..................................... 0.105s 500 - 14000 REPLACE on TEXT PK.................................... 0.167s 510 - 14000 SELECTS on a TEXT PK.................................. 0.188s 520 - 14000 SELECT DISTINCT....................................... 0.137s 980 - PRAGMA integrity_check...................................... 0.484s 990 - ANALYZE..................................................... 0.065s TOTAL....................................................... 4.680s ok github.com/ncruces/go-sqlite3/internal/vfs/tests/speedtest1 5.405s ``` Fixes #71 Signed-off-by: Achille Roussel <[email protected]>
- Loading branch information