pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1720742 - in /pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox: cff/CFFCharset.java cff/CFFEncoding.java cff/CFFOperator.java cff/CharStringCommand.java encoding/Encoding.java
Date Fri, 18 Dec 2015 09:57:41 GMT
Author: lehmi
Date: Fri Dec 18 09:57:41 2015
New Revision: 1720742

URL: http://svn.apache.org/viewvc?rev=1720742&view=rev
Log:
PDFBOX-3131: preallocate the expected amount of values for collections to avoid massive resizing
operations

Modified:
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFCharset.java
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFEncoding.java
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFOperator.java
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CharStringCommand.java
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/encoding/Encoding.java

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFCharset.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFCharset.java?rev=1720742&r1=1720741&r2=1720742&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFCharset.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFCharset.java Fri Dec 18 09:57:41
2015
@@ -29,13 +29,13 @@ import java.util.Map;
 public abstract class CFFCharset
 {
     private final boolean isCIDFont;
-    private final Map<Integer, Integer> sidOrCidToGid = new HashMap<Integer, Integer>();
-    private final Map<Integer, Integer> gidToSid = new HashMap<Integer, Integer>();
-    private final Map<String, Integer> nameToSid = new HashMap<String, Integer>();
+    private final Map<Integer, Integer> sidOrCidToGid = new HashMap<Integer, Integer>(250);
+    private final Map<Integer, Integer> gidToSid = new HashMap<Integer, Integer>(250);
+    private final Map<String, Integer> nameToSid = new HashMap<String, Integer>(250);
 
     // inverse
     private final Map<Integer, Integer> gidToCid = new HashMap<Integer, Integer>();
-    private final Map<Integer, String> gidToName = new HashMap<Integer, String>();
+    private final Map<Integer, String> gidToName = new HashMap<Integer, String>(250);
 
     /**
      * Package-private constructor for use by subclasses.

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFEncoding.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFEncoding.java?rev=1720742&r1=1720741&r2=1720742&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFEncoding.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFEncoding.java Fri Dec 18
09:57:41 2015
@@ -29,7 +29,7 @@ import java.util.Map;
  */
 public abstract class CFFEncoding extends Encoding
 {
-    private final Map<Integer, String> codeToName = new HashMap<Integer, String>();
+    private final Map<Integer, String> codeToName = new HashMap<Integer, String>(250);
 
     /**
      * Package-private constructor for subclasses.

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFOperator.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFOperator.java?rev=1720742&r1=1720741&r2=1720742&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFOperator.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CFFOperator.java Fri Dec 18
09:57:41 2015
@@ -202,8 +202,8 @@ public final class CFFOperator
         }
     }
 
-    private static Map<CFFOperator.Key, CFFOperator> keyMap = new LinkedHashMap<CFFOperator.Key,
CFFOperator>();
-    private static Map<String, CFFOperator> nameMap = new LinkedHashMap<String,
CFFOperator>();
+    private static Map<CFFOperator.Key, CFFOperator> keyMap = new LinkedHashMap<CFFOperator.Key,
CFFOperator>(52);
+    private static Map<String, CFFOperator> nameMap = new LinkedHashMap<String,
CFFOperator>(52);
 
     static
     {

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CharStringCommand.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CharStringCommand.java?rev=1720742&r1=1720741&r2=1720742&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CharStringCommand.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CharStringCommand.java Fri Dec
18 09:57:41 2015
@@ -223,7 +223,7 @@ public class CharStringCommand
 
     static
     {
-        Map<Key, String> map = new LinkedHashMap<Key, String>();
+        Map<Key, String> map = new LinkedHashMap<Key, String>(26);
         map.put(new Key(1), "hstem");
         map.put(new Key(3), "vstem");
         map.put(new Key(4), "vmoveto");
@@ -261,7 +261,7 @@ public class CharStringCommand
 
     static
     {
-        Map<Key, String> map = new LinkedHashMap<Key, String>();
+        Map<Key, String> map = new LinkedHashMap<Key, String>(48);
         map.put(new Key(1), "hstem");
         map.put(new Key(3), "vstem");
         map.put(new Key(4), "vmoveto");

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/encoding/Encoding.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/encoding/Encoding.java?rev=1720742&r1=1720741&r2=1720742&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/encoding/Encoding.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/encoding/Encoding.java Fri Dec 18
09:57:41 2015
@@ -30,12 +30,12 @@ public abstract class Encoding
     /**
      * This is a mapping from a character code to a character name.
      */
-    protected Map<Integer,String> codeToName = new HashMap<Integer,String>();
+    protected Map<Integer,String> codeToName = new HashMap<Integer,String>(250);
 
     /**
      * This is a mapping from a character name to a character code.
      */
-    protected Map<String,Integer> nameToCode = new HashMap<String,Integer>();
+    protected Map<String,Integer> nameToCode = new HashMap<String,Integer>(250);
 
     /**
      * This will add a character encoding.



Mime
View raw message