[
https://issues.apache.org/jira/browse/WW-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15044239#comment-15044239
]
zhouyanming commented on WW-4575:
---------------------------------
SecurityMemberAccess.isPackageExcluded() is called heavily, replace regex with
String.startsWith() will save lots of CPU time.
{code:java}
protected boolean isPackageExcluded(Package targetPackage, Package
memberPackage) {
if (LOG.isWarnEnabled() && (targetPackage == null || memberPackage ==
null)) {
LOG.warn("The use of the default (unnamed) package is
discouraged!");
}
final String targetPackageName = targetPackage == null ? "" :
targetPackage.getName();
final String memberPackageName = memberPackage == null ? "" :
memberPackage.getName();
return isPackageExcluded(targetPackageName) ||
isPackageExcluded(memberPackageName);
}
protected boolean isPackageExcluded(String packageName) {
return packageName.startsWith("java.lang.") ||
packageName.startsWith("ognl.")
|| packageName.startsWith("javax.") &&
!packageName.startsWith("javax.servlet.");
}
{code}
> Fix performance regression
> --------------------------
>
> Key: WW-4575
> URL: https://issues.apache.org/jira/browse/WW-4575
> Project: Struts 2
> Issue Type: Task
> Affects Versions: 2.3.20, 2.3.24
> Reporter: zhouyanming
> Fix For: 2.3.25
>
>
> I have an application run with struts2, recently I found my application
> performance downgraded if struts2 upgraded. a special use case:
> ab -n 3000 -c 150 http://localhost/login
> ||requests/second||struts2 version||
> |684|2.3.16|
> |515|2.3.18|
> |312|2.3.24|
> It's appreciatory if someon test with official example.
> I think struts2 should focus on performance improvement, make struts2 more
> configurable to deal with performance and security trade-off.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)