RE: escapeXml() optimizations

2004-02-09 Thread Martin van Dijken
The simplest optimization would be to create the 'sb' buffer at least as big as the 'input' string. After all, even if there were no actual substitutions, the 'sb' would be as big, and this would avoid StringBuffer doing a lot of reallocations, especially if 'input' is more than the 16

Re: escapeXml() optimizations

2004-02-09 Thread David Wall
Try it simpler: Yes, that's much nicer. See what happens when I tried to fit a solution in to the previous coding paradigm? wink This was better refactored and it certainly does the job much nicer. The only change I'd make is to make the StringBuffer size length+5 to ensure we can at least