parser: accelerate DecodeLayers#657
parser: accelerate DecodeLayers#657yerden wants to merge 1 commit intogoogle:masterfrom yerden:decoding-layers-accel
Conversation
Attempt to use array to search DecodingLayer, fallback to map only if LayerType is too big. Signed-off-by: Yerden Zhumabekov <[email protected]>
|
And one more thing. I don't want to overgeneralize (and please correct me if i'm wrong) but I suspect that most common usage pattern here suggests not so many DecodingLayer-s in a single DecodingLayerParser. Most of the time, up to ten layers is enough. If that's true, naive linear search of DecodingLayer beats That's a definite win if some custom LayerType values are in use, so you don't want to use array indexing (too big values). And, in case of a simple Eth->IPv4->TCP packet, about 60-70% of DecodeLayers() call duration amounts to searching for an appropriate DecodingLayer rather than layer decoding itself. |
|
I will investigate other ways to boost performance and will return later. |
|
Hey, yerden, This looked super promising; is there a reason the PR was closed out? |
|
Well, other ideas came up to me, like:
So... I thought I should take a break, test these ideas and revisit later. Or, alternatively, I can simply reopen this PR, allow it to merge and work on it for next PR. Any ideas? |
Most of frequently used (and natively supported) LayerType values are not very big, so we may attempt to use array to search
DecodingLayer, fallback to map only ifLayerTypeis too big. Similar approach as inRegisterLayerType. I chose 256 as a decent threshold.Results on Xeon(R) CPU E5-2620: