2014-09-12 13:20 GMT+04:00 Mark Thomas <ma...@apache.org>: > On 12/09/2014 10:08, Mark Thomas wrote: >> On 12/09/2014 09:36, Konstantin Kolinko wrote: >>> Hi! >>> >>> Reviewing BCEL method Utility.swallowUnknownAttribute(...), I think >>> the same approach can be used for all other attributes that we ignore, >>> ignoring their internal structure. >>> >>> That is: we know length of their data. In Attribute.readAttribute(): >>> >>> // Length of data in bytes >>> length = file.readInt(); >>> >>> I have yet to verify this with specification, but it looks promising. >> >> I did a quick test using the newly added performance test and the Jira >> jars. It certainly works - no errors are reported - but there is no >> noticeable performance improvement. What it does do is remove a large >> chunk of code so, if your specification check confirms this is OK, I am >> +1 purely based on the simplification benefits. > > I've tweaked the performance test to focus timing info on the BCEL part > of the code after some profiling showed a lot of time was being spent > reading the class files from the JAR. There is a performance improvement > here (5-10%) so if this change is spec compliant there is an even > stronger reason for doing it.
Yes, it is compliant. The Java Virtual Machine Specification, Java SE 7 Edition Chapter 4.7 Attributes http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7 The structure is [[[ attribute_info { u2 attribute_name_index; u4 attribute_length; u1 info[attribute_length]; } ]]] For reference, JLS/JVM specifications page: http://docs.oracle.com/javase/specs/ PDF version of the spec may be easier to work with. Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org