jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1555596 - /jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetChangesCapture.java
Date Sun, 05 Jan 2014 18:06:48 GMT
Author: andy
Date: Sun Jan  5 18:06:47 2014
New Revision: 1555596

URL: http://svn.apache.org/r1555596
Log:
Switch to using a linked list for recording QuadActions due to ArrayList's copy-grow design.

Modified:
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetChangesCapture.java

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetChangesCapture.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetChangesCapture.java?rev=1555596&r1=1555595&r2=1555596&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetChangesCapture.java
(original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/core/DatasetChangesCapture.java
Sun Jan  5 18:06:47 2014
@@ -18,8 +18,8 @@
 
 package com.hp.hpl.jena.sparql.core;
 
-import java.util.ArrayList ;
 import java.util.Collections ;
+import java.util.LinkedList ;
 import java.util.List ;
 
 import org.apache.jena.atlas.lib.Pair ;
@@ -29,7 +29,14 @@ import com.hp.hpl.jena.graph.Node ;
 /** Capture a record of quad actions */ 
 public class DatasetChangesCapture implements DatasetChanges
 {
-    final private List<Pair<QuadAction, Quad>> actions = new ArrayList<Pair<QuadAction,
Quad>>() ;
+    // ArrayLists have an annoying issue that they grow by copying the internal []-array.
+    // This growth is by a fixed factor of adding 50% which for an array
+    // with little guidance as to likely size, can lead to undesirable GC
+    // and copy-time issues.
+    // Using a LinkedList avoids this although it adds overhead for list entries.  
+    final private List<Pair<QuadAction, Quad>> actions = new LinkedList<Pair<QuadAction,Quad>>()
;  
+        //new ArrayList<Pair<QuadAction, Quad>>() ;
+        
     final private boolean captureAdd ;
     final private boolean captureDelete ;
     final private boolean captureNoAdd ;



Mime
View raw message