Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a method to cap the size of the cache in DijkstraShortestPaths and DijkstraDistance #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lhepto
Copy link

@lhepto lhepto commented May 6, 2017

This is a proof of concept to show the benefit of implementing a cap on the size of the cache.
It allows the user to perform a large number of shortest path calculations on large graph, continuously without GC or memory issues, when they are memory constrained in the VM.
See the new test cases TestCachingLargeGraph for an example.
Tested with VM options: -Xms128m-Xmx750m

…nd DijkstraDistance, which allows it to run on large graph continuously without GC or memory issues
@@ -66,10 +66,11 @@
{
protected Hypergraph<V,E> g;
protected Function<? super E,? extends Number> nev;
protected Map<V,SourceData> sourceMap; // a map of source vertices to an instance of SourceData
protected LinkedHashMap<V,SourceData> sourceMap; // a map of source vertices to an instance of SourceData
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry if I missed a discussion of this, but is the cost (of a possible virtual lookup when declaring as the most general type) really a factor with modern JVMs?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is a factor on modern JVMs, I've personally not heard of it. :/

IIRC, it's more idiomatic to keep the base type here as Map, i.e. whatever interface is most generic, or as high up the type hierarchy as possible, that has all the methods one needs.

Just my 2 cents.

@tomnelson
Copy link
Contributor

Was there ever a plan to merge this?

@jrtom
Copy link
Owner

jrtom commented Jan 16, 2018

It's on my list of things to look at before the 3.0 release. Haven't gotten to it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants