Commit Graph

1 Commits

Author SHA1 Message Date
Stefan 579f7e4a52 chore(wallet) optimize the filer query
Main changes:

- Use tr_type instead of IN clause
- Use binary (X'...' syntax) directly into the query instead of
  converting DB values to HEX
  - Found to be slightly faster than query parameters in the dedicated benchmark
  - Didn't see much improvement in filter benchmarks
- Tried various combinations of optimizations but without impressive performance results

Benchmark results:

| Name                   | Original   | tr_type   | join     | hex      | no-db     | db_only   |     last |    net_j |
|:-----------------------|:-----------|:----------|:---------|:---------|:----------|:----------|---------:|---------:|
| RAM_NoFilter-10        | 49580229   | 51253242  | 51112462 | 50915133 | 121217817 | 141691008 | 50908642 | 50239712 |
| SSD_NoFilter-10        | 49963604   | 51393588  | 51213038 | 50881483 | 120785679 | 141063467 | 50462767 | 49676867 |
| SSD_MovingWindow-10    | 53695712   | 54155292  | 54161733 | 54061325 | 126966633 | 146866017 | 53479929 | 53350475 |
| SSD_AllAddr_AllTos-10  | 41382804   | 41195225  | 51684175 | 52107262 | 64348100  | 97608833  | 50523529 | 49968321 |
| SSD_OneAddress-10      | 34945275   | 35103850  | 31066429 | 31328762 | 50927300  | 54322971  | 30098529 | 30252546 |
| FilterSend_AllAddr-10  | 39546808   | 37566604  | 38389725 | 38260738 | 114820458 | 125588408 | 37127625 | 36864575 |
| FilterSend_6Addr-10    | 41221458   | 41111225  | 40848288 | 40135492 | 118629700 | 128200467 | 38942521 | 39012100 |
| FilterThreeNetworks-10 | -          | -         | -        | -        | -         | -         | 50058929 | 49854450 |

Update status-desktop: #11036
2023-09-21 13:56:44 +02:00