Skip to content

No algorithm object reuse #18

Closed
Closed

Description

@agouge

See here.

An IllegalStateException is thrown every time I try to calculate a path more than once because I can't call the clear() method since it no longer exists.

Activity

  1. karussell commented on Mar 1, 2013

    @karussell
    Member

    An algorithm could be re-used until this commit. Reusing caused some problems in the past, so just create a new instance to avoid this, see the new RoutingAlgorithmFactory. E.g. calling clear for trove maps is slow compared to recreation as it needs to fill arrays with zeros. Also in a server environment you would have to take great care to use one instance per thread only (with the clear method).

    Especially with the introduced possibility to use an algorithm instance for different vehicle types it is important to avoid a wrong configuration of an algorithm.

    This approach isn't that memory efficient and will be probably improved at a later time. Let me know if you have memory problems due to that change.

  2. karussell commented on Apr 22, 2013

    @karussell
    Member

    I'm reopening this here as it should get fixed somehow. At least testing this out in a production environment with a speed test and comparing re-usage vs. creating new ones

  3. karussell commented on May 7, 2013

    @karussell
    Member

    I've introduced a new dijkstra class which is more efficient when doing lots of queries of the same type and weight and starting point like it is done in the preparation process for contraction hierarchies. It completely avoids a map but requires to allocate some arrays for ALL nodes in the graph.

    For the other algorithms: just reusing (via calling clear) leads to even slower responds times (compared to creating new objects). Some minor improvements can be made when allocating the new objects (heap and map) with the same size of the older ones, but this depends a lot on path length of previous request and is at the moment not worth the effort. (+only worth for none-CH queries)

  4. added a commit that references this issue on May 15, 2015
  5. added a commit that references this issue on Sep 13, 2017
  6. added a commit that references this issue on Jul 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions