ctf: Replace StructDeclaration map with an array
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Tue, 9 Feb 2016 02:34:57 +0000 (21:34 -0500)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Mon, 4 Apr 2016 18:02:57 +0000 (14:02 -0400)
commitba95ec1fd84362b2d2269aa94c2e9822230d3320
tree447ddc4f7cb174c6d66835c44ddcfdb810c10b43
parent8765f95a3c5f8a3f0035a981c8d242e793e22c6d
ctf: Replace StructDeclaration map with an array

This will cause a 10% performance improvement while reading a trace

The LinkedHashMap of fields in a struct declaration is much slower
to iterate through than a regular array. This patch replaces the map
with an array. This yields a performance gain of approx 10%.

The patch also changes some methods behavior.

* getMaximumSize() clamps to Integer#MAX_VALUE instead of overflowing
* addField no longer overwrites a value already in the declaration.

As addField has been modified, extra attention has to be put on
the parser in the case of degenerate test cases to maintain the
current behavior.

Change-Id: Id76b3432b2c973a1e2cbecba5a9b22ad76a68162
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/66168
Reviewed-by: Hudson CI
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/StructDeclaration.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/metadata/tsdl/TypeSpecifierListParser.java
This page took 0.025881 seconds and 5 git commands to generate.