Skip to content

Commit

Permalink
[GTK] Optimize TreeItem constructor by removing ID system eclipse-pla…
Browse files Browse the repository at this point in the history
…tform#882

The ID system tracking association of every TreeItem with GTK model
entry had been using GTK.gtk_tree_store_set() to persist a key in GTK
model. This operation has linear execution  time over model size.

IDs were replaced with tree paths and strong references, which, if
implemented right, have logarithmic execution time on balanced trees and
constant execution time on wide trees.

Performance improvement is proven by running
org.eclipse.swt.tests.junit.performance.Test_org_eclipse_swt_widgets_Tree.jfaceReveal()

In test jfaceReveal[Shape: STAR, virtual: true]:
10_000 elements:  141_061_117ns -> 4_369_889ns
100_000 elements: 10_761_449_641ns -> 181_898_611ns (-98%)
  • Loading branch information
basilevs authored and jukzi committed Mar 8, 2024
1 parent 2a51e8c commit 70b25e9
Show file tree
Hide file tree
Showing 5 changed files with 354 additions and 452 deletions.
Loading

0 comments on commit 70b25e9

Please sign in to comment.