libs icon indicating copy to clipboard operation
libs copied to clipboard

improve fields parsing performance by eliminating temp strings.

Open VadimZy opened this issue 3 years ago • 5 comments

improve parser performance by statically precompiling regex

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind design

/kind feature

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area libsinsp

Does this PR require a change in the driver versions? NO

What this PR does / why we need it: improving falco parsing performance

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?: NO

NONE

VadimZy avatar Aug 03 '22 04:08 VadimZy

Also, please sign-off your commits (https://github.com/falcosecurity/.github/blob/master/CONTRIBUTING.md#developer-certificate-of-origin). Thanks Vadim!

jasondellaluce avatar Aug 03 '22 09:08 jasondellaluce

This looks like a great set of changes! While we're in here mucking with regexes, what do you (and other reviewers) think about using RE2 instead of c++ regex? I believe all of these are compatible with RE2 (e.g. don't backtrack) and from what I recall, including https://github.com/HFTrader/regex-performance, RE2 appears to be much much faster.

mstemm avatar Aug 08 '22 20:08 mstemm

/ok-to-test

jasondellaluce avatar Aug 11 '22 17:08 jasondellaluce

@mstemm

While we're in here mucking with regexes, what do you (and other reviewers) think about using RE2 instead of c++ regex?

I think it would be quite beneficial to have a portable REGEX in Falco/Libs

VadimZy avatar Aug 12 '22 17:08 VadimZy

While we're in here mucking with regexes, what do you (and other reviewers) think about using RE2 instead of c++ regex?

I think that would be a very good contribution in our case. Regex inconsistency makes our code troublesome and harder to maintain. We'll need to open separate PRs and track the progress in an issue eventually.

jasondellaluce avatar Aug 22 '22 08:08 jasondellaluce

LGTM label has been added.

Git tree hash: 3f057211ddf02873415d027b14a51d4735d9df69

poiana avatar Aug 22 '22 08:08 poiana

FYI the regex portability problem has been addressed in https://github.com/falcosecurity/libs/pull/556.

jasondellaluce avatar Aug 25 '22 10:08 jasondellaluce

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FedeDP, VadimZy

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

poiana avatar Aug 25 '22 10:08 poiana