Skip to content

Needless cose calculations when gravity set to zero #2898

@kobajder

Description

@kobajder

Environment info
All OSes, all browsers, and nodejs

Current (buggy) behaviour

The calculateGravityForces method runs all calculations even when the options.gravity is set to 0 (zero).

Desired behaviour

At the calculateGravityForces method start, there could be some check as

if (options.gravity === 0) {
  return;
}

That would make the cose calculation faster in these cases.

Minimum steps to reproduce

  1. configure cose gravity to 0 (zero)
  2. prepare some nodes and edges
  3. execute cose

Metadata

Metadata

Assignees

No one assigned

    Labels

    performanceImproving speed and memory usage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions