Skip to content

Slow performance on millions of objects during VirtualUniverse.removeAllLocales or release resource. #32

@morris821028

Description

@morris821028

Scenario

  1. Load millions of TransformGroup objects into specific Locales in two-level hierarchy.
- Locale
    -  TransformGroupRetained X
        -  GroupRetained
           -   TransformGroupRetained A... (millions of object in this level)
           -   TransformGroupRetained B... (millions of object in this level)
  1. Call VirtualUniverse.removeAllLocales. We will find the $O(N^2)$ time during release resource.

Reason

TransformGroupRetained.removeNodeData will call parent TransformGroupRetained X childTransformLinks.remove step by step.

Possible Solution

Predict the live state from parent class NodeRetained.

void clearLive(SetLiveState s) {

void clearLive(SetLiveState s) {

// in TransformGroupRetained.
    @Override
    void clearLive(SetLiveState s) {

        Targets[] savedTransformTargets = null;

        savedTransformTargets = s.transformTargets;
	// no need to gather targets from tg in clear live
        s.transformTargets = null;
        
        if (refCount - s.refCount <= 0) { // predict live to prevent children update.
            childTransformLinks.clear();
        }

	super.clearLive(s);
        ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions