From: <eg...@us...> - 2006-12-07 12:54:54
|
Revision: 7423 http://svn.sourceforge.net/cdk/?rev=7423&view=rev Author: egonw Date: 2006-12-07 04:54:37 -0800 (Thu, 07 Dec 2006) Log Message: ----------- Use the unsychronized HashMap instead of Hashtable in the major isotope cache. Speeds up SMILES generation by at least 20% (actual measured data), and likely many other things too. Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/config/IsotopeFactory.java Modified: trunk/cdk/src/org/openscience/cdk/config/IsotopeFactory.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/config/IsotopeFactory.java 2006-12-07 12:22:16 UTC (rev 7422) +++ trunk/cdk/src/org/openscience/cdk/config/IsotopeFactory.java 2006-12-07 12:54:37 UTC (rev 7423) @@ -27,6 +27,7 @@ import java.io.InputStream; import java.io.OptionalDataException; import java.util.ArrayList; +import java.util.HashMap; import java.util.Hashtable; import java.util.List; @@ -69,7 +70,7 @@ private static IsotopeFactory ifac = null; private List isotopes = null; - private Hashtable majorIsotopes = null; + private HashMap majorIsotopes = null; private boolean debug = false; private LoggingTool logger; @@ -113,7 +114,7 @@ Isotope isotope = (Isotope)isotopes.elementAt(f); } What's this loop for?? */ - majorIsotopes = new Hashtable(); + majorIsotopes = new HashMap(); } @@ -227,7 +228,8 @@ */ public IIsotope getMajorIsotope(String symbol) { IIsotope major = null; - if (majorIsotopes.contains(symbol)) { + if (majorIsotopes.containsKey( + symbol)) { major = (IIsotope)majorIsotopes.get(symbol); } else { for (int f = 0; f < isotopes.size(); f++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |