ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] How to improve LUA dissector performance?

From: Jeff Morriss <jeff.morriss.ws@xxxxxxxxx>
Date: Tue, 16 Apr 2019 14:26:37 -0500

On Mon, Apr 15, 2019 at 9:04 AM David Aldrich <david.aldrich.ntml@xxxxxxxxx> wrote:
I haven't seen any answers to my question below. Any thoughts please?

Hi
I have written a LUA dissector that analyses large packets that consist of control information and  IQ data (complex numbers).  Until recently I displayed the IQ data as a string and performance was fine. However, I now dissect and display each IQ value and the user has complained of very slow performance when analysing a large capture set of packets.

I imagined that dissection of the IQ data would only occur when the tree was expanded to display that data.  The reported slowness suggests that the data for all packets is always dissected regardless of whether or not the data is viewed. Is that correct?

Apart from re-coding as a C++ dissector (a lot of work) how could I optimise the current LUA code?

Could I add a switch to control whether or not IQ data is dissected?

You could try avoiding doing dissection work if the tree is NULL; I'm assuming that the tree is actually NULL in Lua (I don't know).

In C we've decided checking for tree==NULL isn't worth the code complication; maybe it could help with a slower language like Lua?