Changeset 13006 for trunk/abcl/src/org


Ignore:
Timestamp:
11/06/10 08:58:57 (11 years ago)
Author:
ehuelsmann
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/Pathname.java

    r12974 r13006  
    937937
    938938    public static boolean isValidURL(String s) {
     939        // On Windows, the scheme "[A-Z]:.*" is ambiguous; reject as urls
     940        // This special case reduced exceptions while compiling Maxima by 90%+
     941        if (Utilities.isPlatformWindows && s.length() >= 2 && s.charAt(1) == ':') {
     942            char c = s.charAt(0);
     943            if (('A' <= s.charAt(0) && s.charAt(0) <= 'Z')
     944                    || ('a' <= s.charAt(0) && s.charAt(0) <= 'z'))
     945                return false;
     946        }
     947
     948        if (s.indexOf(':') == -1) // no schema separator; can't be valid
     949            return false;
     950       
    939951        try {
    940952            URL url = new URL(s);
    941953        } catch (MalformedURLException e) {
     954            // Generating an exception is a heavy operation,
     955            // we want to try hard not to get into this branch, without
     956            // implementing the URL class ourselves
    942957            return false;
    943958        }
Note: See TracChangeset for help on using the changeset viewer.