Skip to content

Comparing with Java

RazGavrieli edited this page Dec 22, 2021 · 2 revisions

First and most important thing we noticed, is that python did not have memory limit. We tried creating a graph with 10m nodes, and the process did not shut it self down. It also didn't finish before with terminated it by ourselves. While creating 10m graph, python used more than 12GB of system memory!

It is also important to note that in our java project we did have few bugs and mistakes in our code, therefore, comparing the two won't be a direct comparison but still we have interesting insights about the data we gathered.

Comparison

  • Loaded on a pc with 16GB of ram and an I7-7700HQ (mobile chip).
  • Each node has exactly 10 out edges.
  • times are in MS

We will be comparing the two programs on 1k and 10k graphs, the java program is not capable of loading bigger graphs. To see the full performance report of the python program, please head to the 'Analyzing Performance' tab

LOADING TIMES

N. of nodes 1k 10k
Java 110 4467
Python 41 452

SAVING TIMES

N. of nodes 1k 10k
Java 231 6013
Python 100 1037

PATH TIMES

N. of nodes 1k 10k
Java 0 51
Python 16 210

CENTER TIMES

N. of nodes 1k 10k
Java 969 timeout
Python 15900 1886900

TSP TIMES

N. of nodes 1k 10k
Java timeout timeout
Python 117 1883

chartjavapython1k

chartjavapython10k

We can clearly see in the charts, that java worked much slower than python in loading and saving the graphs. It might be because of the way we implemented edges differently in Java. Also, we can see how python has not been timed-out, even in a 30min work with big amounts of memory used. While java threw out-of-heap error very quickly.

Unfortunately, due to the out-of-heap error in java, we do not have a lot of data about the algorithm speed for large graphs in java. Mainly the ones that use dijikstra's algorithm. For path and center times we can clearly see that Java is faster. But when we try to load larger graphs to judge that, the java program fails.

Clone this wiki locally