Files
pallectrum/electrum/gui
наб 8da694c9c3 history_list: pre-compute sort keys, don't launder getting them through get_data_for_role()
endInsertRows() triggers a sort, the history sort/filter proxy model
then launders the comparison requests through get_data_for_role()
with a custom key, which is then especially looked up in there,
but custom-flattened in the proxy model. This is OO hell

Measuring refresh() from after if transactions == self.transactions: return
to the final return, sorting the wallet from #9958/#6625 takes ~3.5s
and 132348 get_data_for_role() calls

Beside that get_data_for_role() is called maybe 10 times per on-hover?
It's immaterial

Thus: compute the sorting keys when constructing the HistoryNode
and use them directly in the comparison.
This decouples get_data_for_role() from the sorter
and speeds the sort up by ~2x,
now being mostly made up of the python interpreter overhead(?)
for upcalls to lessThan()

A dict wins with a list for the lookup a tiny bit
(and is 100x better code-wise):

1.896097298245877s list
1.840533264912665s list
1.757185084745288s list
1.8990754359401762s list
1.914668960031122s list
1.9349112827330828s list
2.432649422902614s list
1.929884395096451s list
1.9610795709304512s list
1.8694845158606768s list
1.9600030612200499s list
1.9199693519622087s dict
2.0466488380916417s dict
1.8510140180587769s dict
1.8978681536391377s dict
2.0079748439602554s dict
1.9111531740054488s dict
1.9525738609954715s dict
1.850804285146296s dict
1.860573346260935s dict
1.95173170696944s dict
1.8481200002133846s dict

Benchmark 1: dict
  Time (mean ± σ):       1918.039234 ms ±    63.688609 ms
  Range (min … max):     1848.120000 ms …  2046.648838 ms    11 runs

Benchmark 2: list
  Time (mean ± σ):       1945.052027 ms ±   164.019588 ms
  Range (min … max):     1757.185085 ms …  2432.649423 ms    11 runs

Summary
  'dict' ran
    1.014084 ± 0.090082 times faster than 'list'
2025-07-01 03:32:42 +02:00
..
2025-06-30 12:56:22 +02:00
2023-08-30 16:47:37 +00:00
2025-06-29 22:25:56 +00:00
2025-06-29 22:25:56 +00:00