Skip to content

Avoid O(n²) graph ordering when adding nodes 'organically' #467

Open
@orottier

Description

@orottier

Given a sorted audio graph, the following typical operation should not trigger a full sort:

  • let src = create_oscillator/buffersource/constant (creates audioparams behind the scenes)
  • let gain = create_gain
  • src.connect(gain)
  • gain.connect(X) - X being the destination node or any other part of the graph

We should be able to prepend the sorted list without any further analysis in the following order

  1. the audioparams feeding into the source
  2. the source
  3. the gain

Currently, the full sort is triggered by self.ordered.clear(); in the Graph object when adding or removing edges.

Sidequest - do we even need to sort when edges are removed? Only if that edge was part of a cycle which after removal can be unmuted!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions