Class GraphMem2Fast

All Implemented Interfaces:
org.apache.jena.atlas.lib.Copyable<GraphMem2>, Graph, GraphWithPerform

public class GraphMem2Fast extends GraphMem2
A graph that stores triples in memory. This class is not thread-safe.

Purpose: GraphMem2Fast is a strong candidate for becoming the new default in-memory graph in the upcoming Jena 5, thanks to its improved performance and relatively minor increase in memory usage.

Faster than GraphMem2Legacy (specially Graph#add, Graph#find and Graph#stream) Removing triples is a bit slower than GraphMem2Legacy. Memory consumption is about 6-35% higher than GraphMem2Legacy Maps and sets are based on FastHashBase Benefits from multiple small optimizations. (see: FastTripleStore)

The heritage of GraphMem: - Also uses 3 hash-maps indexed by subjects, predicates, and objects - Values of the maps also switch from arrays to hash sets for the triples

  • Constructor Details

    • GraphMem2Fast

      public GraphMem2Fast()
  • Method Details

    • copy

      public GraphMem2Fast copy()
      Description copied from class: GraphMem2
      Creates a copy of this graph. Since the triples and nodes are immutable, the copy contains the same triples and nodes as this graph. Modifications to the copy will not affect this graph.
      Specified by:
      copy in interface org.apache.jena.atlas.lib.Copyable<GraphMem2>
      copy in class GraphMem2
      independent copy of the current graph