Re: WOHyperlink, BOZO_AMPERSAND Revisited
Re: WOHyperlink, BOZO_AMPERSAND Revisited
- Subject: Re: WOHyperlink, BOZO_AMPERSAND Revisited
- From: Galen Rhodes <email@hidden>
- Date: Mon, 30 Jul 2007 13:14:58 -0400
There's also a couple of other things you can do to make this a LOT faster.
If you're using JDK 1.5, you can use String.replace(CharSequence, CharSequence) instead of String.replaceAll(String, String). The reason is that String.replaceAll(String, String) uses regex which is very costly. In this case the pattern of characters that you're searching for is always going to be the same - "&amp;" - so using regex is serious overkill.
If you're not using JDK 1.5 you might try just using:
url ="" "&amp;").componentsJoinedByString("&");
Even though you're creating a temporary array it might still be faster than using regex.
On Jul 30, 2007, at 12:47 PM, Alex Johnson wrote: Hi,
Back in Feb 2006, there was a discussion about a bug in WebObjects 5.3.x that caused WOHyperlink to generate doubly-escaped ampersands its URLs (see: <http://lists.apple.com/archives/webobjects-dev/2006/Feb/msg00324.html>). I've been using Daniel Muller's patch <http://lists.apple.com/archives/webobjects-dev/2006/Feb/msg00451.html> ever since.
Recently, I ran up against the performance limitations of this fix: A page with a few hundred links on it takes ~30 seconds to generate, 2/3 of which are spent in the patch code. So, I tweaked the patch to improve its performance, and wanted to share my results (below). Using this version, the page generation is well under one second. The performance improvement comes from in-place manipulation of the response's content, as opposed to replacing the content with a modified copy. This results in a much smaller memory footprint, which greatly reduces the time spent allocating and garbage-collecting throughout the application.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden