[armedbear-cvs] r13006 - trunk/abcl/src/org/armedbear/lisp

Erik Huelsmann ehuelsmann at common-lisp.net
Sat Nov 6 08:58:58 UTC 2010


Author: ehuelsmann
Date: Sat Nov  6 04:58:57 2010
New Revision: 13006

Log:
Reduce the number of exceptions generated inside ABCL
while compiling Maxima by way over 90% (1.3M+ to 100k-).

Modified:
   trunk/abcl/src/org/armedbear/lisp/Pathname.java

Modified: trunk/abcl/src/org/armedbear/lisp/Pathname.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Pathname.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Pathname.java	Sat Nov  6 04:58:57 2010
@@ -936,9 +936,24 @@
     }
 
     public static boolean isValidURL(String s) {
+        // On Windows, the scheme "[A-Z]:.*" is ambiguous; reject as urls
+        // This special case reduced exceptions while compiling Maxima by 90%+
+        if (Utilities.isPlatformWindows && s.length() >= 2 && s.charAt(1) == ':') {
+            char c = s.charAt(0);
+            if (('A' <= s.charAt(0) && s.charAt(0) <= 'Z')
+                    || ('a' <= s.charAt(0) && s.charAt(0) <= 'z'))
+                return false;
+        }
+
+        if (s.indexOf(':') == -1) // no schema separator; can't be valid
+            return false;
+        
         try {
             URL url = new URL(s);
         } catch (MalformedURLException e) {
+            // Generating an exception is a heavy operation,
+            // we want to try hard not to get into this branch, without
+            // implementing the URL class ourselves
             return false;
         }
         return true;




More information about the armedbear-cvs mailing list