[apparmor] [RFC/patch] parser: reduce virtual_cast<> calls when normalizing tree
Steve Beattie
steve at nxnw.org
Wed Apr 6 00:36:48 UTC 2011
With the prior patch set fixing how the parser is built so that gprof
profiling could work, I went ahead and did a few experiments with it.
One of the surprising results (to me, anyway) was that in synthetic
sample workloads, the parser was spending fully 40% of its time in
dynamic_cast<> calls in the dfa library.
The attached patch I'm submitting for comment and consideration,
particularly by jjohansen, as it is a start in a direction of trying
to reduce the amount of usage of dynamic_cast<>s by pushing recursive
or iterative function logic into the Node classes themselves,
so as to eliminate a number of the type tests (which is what the
dynamic_cast<> calls are doing). Is it both an acceptable direction to
take structurally and stylistically? I don't want to continue down this
path if it hampers jjohansen's understanding of the data structures.
In non-rigorous benchmarking, again with synthetic workloads
(generated by the parser stress test), I see roughly 10-15% overall
reduction in the amount of time to parse, generate, and compress a
given profile set.
Thanks.
--
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: parser-reduce_dynamic_casts.patch
Type: text/x-diff
Size: 5067 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20110405/0aba72c6/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20110405/0aba72c6/attachment.pgp>
More information about the AppArmor
mailing list