Skip to content

Sgh optimizations/v1#10295

Closed
inashivb wants to merge 3 commits intoOISF:masterfrom
inashivb:sgh-optimizations/v1
Closed

Sgh optimizations/v1#10295
inashivb wants to merge 3 commits intoOISF:masterfrom
inashivb:sgh-optimizations/v1

Conversation

@inashivb
Copy link
Member

@inashivb inashivb commented Feb 1, 2024

No description provided.

port is not used and logically makes sense to not be in this struct as
this struct is already referenced by DetectPort itself as a part of
SigGroupHead.
Present scenario
----------------
Currently, as a part of setting signature count per SGH, a max_idx is
passed which could be as high as the highest signature number (internal
ID).

Issue
-----
Not every SGH needs to evaluate all the signatures while setting
the signature count or while creating the match_array.
In a nonideal scenario, when say, there are 2 SGHs and one SGH has 2
signatures and the other one has 60k, given the current scheme of
evaluating max_idx, the max_idx will be set to 60k, and this shall
later be passed on to SigGroupHeadSetSigCnt or
SigGroupHeadBuildMatchArra which shall traverse over all the 60k sigs
for either SGHs.

Other info
----------
This is a very fast operation as the internal arithmetic is done
bitwise.

Patch
-----
The functions SigGroupHeadSetSigCnt and SigGroupHeadBuildMatchArray can
be optimized by storing the max signature id (internal) per SGH (which
also seemed to be the initial intention as per fn comments).
As a result of this, the sig_array is only walked up until the max sig
id of that respective SGH.
@inashivb inashivb force-pushed the sgh-optimizations/v1 branch from 62a0985 to a4722b8 Compare February 1, 2024 11:40
@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 17959

@inashivb inashivb marked this pull request as ready for review February 1, 2024 15:04
@suricata-qa
Copy link

Information:

ERROR: QA failed on SURI_TLPW2_autofp_suri_time.

field baseline test %
SURI_TLPW2_autofp_stats_chk
.uptime 182 192 105.49%

Pipeline 17960

@victorjulien victorjulien added this to the 8.0 milestone Feb 2, 2024
@victorjulien
Copy link
Member

Merged in #10321, thanks!

@inashivb inashivb deleted the sgh-optimizations/v1 branch February 9, 2024 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants