[jboss-jira] [JBoss JIRA] (WFLY-1415) Move away from expensive enum switch
David Lloyd (JIRA)
issues at jboss.org
Mon Jul 27 18:15:05 EDT 2015
[ https://issues.jboss.org/browse/WFLY-1415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13093250#comment-13093250 ]
David Lloyd commented on WFLY-1415:
-----------------------------------
There is no validation that can be done with a values map that cannot be done better with a raw string switch. Many of the examples are just poorly formed (e.g. PicketLink using one structure for all possible XML attribute and element names, without establishing which attributes and elements are even valid at a given level of configuration). Others lean on this pattern when they could just as well be using the straight switch with a default for invalid values.
> Move away from expensive enum switch
> ------------------------------------
>
> Key: WFLY-1415
> URL: https://issues.jboss.org/browse/WFLY-1415
> Project: WildFly
> Issue Type: Task
> Reporter: David Lloyd
> Priority: Minor
> Labels: janitor
> Fix For: 10.0.0.Beta1
>
>
> We use enums and enum switch extensively. These constructs generate many, many additional classes and bloat the code base unnecessarily.
> All cases where we are using enum-based switches for our XML parsers should be converted to use Java 7 String switch instead. The enum values shall be replaced with String constant fields, all enum switches converted to String switches, and all enum types removed from these classes. The net result should be a reduction by dozens if not hundreds of .class files, and possibly a measurable performance boost as well.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
More information about the jboss-jira
mailing list