Java API for KML - Performance

Performance

Performance measurements were carried out on a 2.66Ghz MacBook Pro with a 1066MHz frontside bus, 4GB (two 2GB SO-DIMMs) of 1066MHz DDR3 SDRAM, and a NVIDIA GeForce 9400M graphics processor with 256MB of DDR3 SDRAM shared with main memory. JAK was tested with Java 1.5 and Java 1.6.

The next listing attempts to be as simple as possible in showing how the performance of JAK was measured. It creates a LinerRing with N coordinates (N ∈ 1, 5, 10, 50, 100, 500, 1000, 5000, 10000, 50000, 100000, 500000, 1000000, and 5000000). Figure 4.5 1 shows the expansion of the file size. Once using Coordinate's double constructor and once using Coordinate's 'String' constructor.

Listing 1: Performance test program. Creates N coordinates.
// measure _create_ (START)
final Kml kml = new Kml();
final Document document = kml.createAndSetDocument().withName("StressTest");
final Placemark p = document.createAndAddPlacemark().withName(filename);
final LineString ls = p.createAndSetLineString().withTessellate(true);
final List<Coordinate> coords = ls.createAndSetCoordinates();

for (int i = 0; i < N; i++) {
  coords.add(new Coordinate ( [double | string ] ));
}
// measure _create_ (STOP)

// measure _marshal_ (START)
kml.marshal(new File("file.kml"), false);
// measure _marshal_ (STOP)

// measure _unmarshal_ (START)
Kml.unmarshal(new File("file.kml "), false);
// measure _unmarshal_ (STOP)

The test is composed of three different parts with the performance of each part measured separately:

  1. create
    The object graph with N coordinates is created. The Coordinate class offers two different kinds of constructors KML in the Java world#Figure 5). One constructor takes the coordinate as a string and parses the string internally into latitude, longitude, and altitude as double values (here called the 'String' constructor). The other constructor takes latitude, longitude, and altitude directly as a double value; hence, no time consuming parsing is needed (here it is called the 'double' constructor).
    For results, see Figure 2.
  2. marshal
    The object graph with N coordinates is marshalled into a file.
    For results, see Figure 3.
  3. unmarshal
    The file with N coordinates is unmarshalled back into an object graph.
    For results, see Figure 4.

The times shown are always the average value taken from three test runs.

Annotation
The horizontal scale of all four figures (Figure 1, Figure 2, Figure 3, and Figure 4) shown in this chapter is a logarithmic scale. This is helpful whenever the data covers a large range of values because the logarithm reduces the range, making it a more manageable range.

The size of the output file in megabytes


Figure 1: The size of the output file in megabytes.

Results for part 1 (create)

(as seen in Listing 1)

Figure 2: The fewer seconds needed, the faster the test is. The 'double' constructor is significantly faster than the 'String' constructor. Java 1.6 is approximately twice as fast as Java 1.5 using the 'String' constructor. Java 1.5 and Java 1.6 both have a similar runtime behavior when using the 'double' constructor.

Results for part 2 (marshal)

(as seen in Listing 1)

Figure 3: The fewer seconds needed, the faster the test is. Java 1.6 is approximately twice as fast as Java 1.5 at marshalling the object graph into a file.

Results for part 3 (unmarshal)

(as seen in Listing 1)

Figure 4: The fewer seconds needed, the faster the test is. Java 1.6 is a bit faster than Java 1.5 at unmarshalling a file into an object graph.

Searching JAK

Java API for KML | @Google

Labels

bsd bsd Delete
open open Delete
micromata micromata Delete
license license Delete
automatic automatic Delete
kml kml Delete
ogc ogc Delete
measurement measurement Delete
source source Delete
jak jak Delete
api api Delete
google google Delete
time time Delete
java java Delete
generated generated Delete
hosting hosting Delete
performance performance Delete
jaxb jaxb Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.




PageRank verified www.micromata.de/