wybsw520 / owaspantisamy

Automatically exported from code.google.com/p/owaspantisamy
0 stars 0 forks source link

Fix obvious performance issues #148

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Running antisamy has adverse effects on cpu usage, sometimes painfully so

What version of the product are you using? On what operating system?

Latest release, any os.

A quick profiler run reveals several sources of excessive CPU usage. The 
absolutely simplest one being the use of String#replaceAll which uses compiled 
regexps. The enclosed patch fixes this problem.

(There is still one usage in the Tag.java class which is buggy. It's  called by 
the getRegularExpression method, replaceall in line 173 has no effect since the 
return value is being ignored )

Original issue reported on code.google.com by kristian...@gmail.com on 23 Jan 2013 at 2:32

Attachments:

GoogleCodeExporter commented 8 years ago
I had some trouble applying my original patch , so here goes version 2

Original comment by kristian...@gmail.com on 23 Jan 2013 at 7:30

Attachments:

GoogleCodeExporter commented 8 years ago
I am also attaching a testcase that can be used to test the performance diff of 
this patch on large numbers of small strings. This testcase can also be used to 
test my next patch 

Original comment by kristian...@gmail.com on 23 Jan 2013 at 7:50

Attachments:

GoogleCodeExporter commented 8 years ago
Fixed in fe700ac28958c2cf66545d8d56a7796973a1253a

Original comment by kristian...@gmail.com on 24 Jan 2013 at 7:31