Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] URIUtils performance

Always interested!

--
jesse mcconnell
jesse.mcconnell@xxxxxxxxx

On Tue, Apr 5, 2016 at 3:28 PM, Guillaume Maillard <guillaume.maillard@xxxxxxxxx> wrote:
Hi,

The new version of URIUtils.canonicalPath is "cleaner" but from my JMH benckmark :
- previous implementation : 12 Mops/s
- new implementation : 1 Mops/s

By replacing :
List<String> directories = new ArrayList<>();
Collections.addAll(directories, __PATH_SPLIT.split(path));

by a faster split method like :
public static final List<String> fastSplit(final String string, final char sep) {
final List<String> l = new ArrayList<String>();
final int length = string.length();
final char[] cars = string.toCharArray();
int rfirst = 0;
for (int i = 0; i < length; i++) {
if (cars[i] == sep) {
l.add(new String(cars, rfirst, i - rfirst + 1));
rfirst = i + 1;
}
}

if (rfirst < length) {
l.add(new String(cars, rfirst, length - rfirst + 1));
}
return l;
}

performance are 3Mops/s .

A faster iterator can boost performance too. Are you interested by such improvments?
If yes, I have some hours to spend on it.

Best regards,

Guillaume


_______________________________________________
jetty-dev mailing list
jetty-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-dev


Back to the top