Bug 1489 - GraphUI Group: Resolve Performance Regression in Scene.pickShape(): Drop invisible and clipped shapes
Summary: GraphUI Group: Resolve Performance Regression in Scene.pickShape(): Drop invi...
Status: RESOLVED FIXED
Alias: None
Product: GraphUI
Classification: JogAmp
Component: Core (show other bugs)
Version: 2.6.0
Hardware: All all
: P1 critical
Assignee: Sven Gothel
URL:
Depends on:
Blocks: 805
  Show dependency treegraph
 
Reported: 2024-01-22 02:44 CET by Sven Gothel
Modified: 2024-02-21 13:15 CET (History)
0 users

See Also:
Type: DEFECT
SCM Refs:
5f9fb7159fa33bc979e5050d384b6939658049bd 19fac36ae64ffb219fb40449b537219d74a1f000 8bb2f6dec8ab731b07387b947715fa1959c680e4
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2024-01-22 02:44:50 CET
After implementing Bug 1487 (Frustum Clipping/Culling) and using thousands of shapes within one Group mostly culled (outside of frustum),
overall mouse Scene.pickShape() caused tremendous lagging.

This is caused by Scene.pickShape() traversing through _all_ shapes,
rendered ones, invisible ones and culled ones.

+++

Solution is to have Scene and Group provide a pre-sorted list
of actually rendered shapes, i.e. isVisible() and not culled.

Scene.pickShape() can now use this reduced and pre-sorted list
reducing the load considerably.
Comment 1 Sven Gothel 2024-01-22 06:36:28 CET
commit 5f9fb7159fa33bc979e5050d384b6939658049bd
Bug 1489 - GraphUI Group: Resolve Performance Regression in Scene.pickShape(): Drop invisible and clipped shapes

implemented as described.

+++

    Further
    - cleanup TreeTool
    
    - rename Container methods:
    -- setFrustumCullingEnabled() -> setPMvCullingEnabled()
    -- isFrustumCullingEnabled() -> isPMvCullingEnabled()
    
    - supply Container with
    -- isCullingEnabled()
    -- List<Shape> getRenderedShapes()
    -- isOutside()
    -- isOutside2()
    -- forAllRendered()
Comment 2 Sven Gothel 2024-01-25 08:55:56 CET
19fac36ae64ffb219fb40449b537219d74a1f000
Scene.dispatchMouseEventPickShape(): Reuse PMVMatrix4f, Ray and Vec3f within EDT, reducing temp objects on mouse moves
Comment 3 Sven Gothel 2024-02-21 13:15:37 CET
commit 8bb2f6dec8ab731b07387b947715fa1959c680e4

    Bug 1489: Lock-Free Double-Buffered 'renderedShapes' causes data-race between rendering & input-edt, use synchronized tripple-buffering
    
    Tripple-buffering _almost_ produces zero data-race collisions,
    however .. it still does rarely -> hence synchronize on the used ArrayList<>.
    This adds a minimal chance for blocking the input-EDT,
    but gives correct code & results.
    
    Double-buffered 'renderedShapes' was introduced to resolve Bug 1489
    in commit 5f9fb7159fa33bc979e5050d384b6939658049bd
    
    This solution is tested by passing '-swapInterval 0' via CommandlineOptions for FontView01, UIMediaGrid01 ..,
    i.e. rendering faster than picking and hence provoking the data-race condition.