Skip to content

Cache compiled regular expressions in the log buffer#1322

Merged
kubernetes-prow[bot] merged 1 commit into
kubernetes:masterfrom
DigitalVeer:logbuffer-regexp-cache
Jul 22, 2026
Merged

Cache compiled regular expressions in the log buffer#1322
kubernetes-prow[bot] merged 1 commit into
kubernetes:masterfrom
DigitalVeer:logbuffer-regexp-cache

Conversation

@DigitalVeer

Copy link
Copy Markdown
Contributor

Summary

The log buffer keeps each compiled regular expression in a cache.
The cache size is not more than the number of patterns given to Match.
This PR removes the TODO in log_buffer.go.

Benchmark

One Match call with a default kernel monitor pattern:

Time per call Memory per call Allocations per call
Before 2590 ns 9265 B 49
After 211 ns 776 B 1
NONE

This change keeps each compiled regular expression in a cache in the
log buffer. The cache size is not more than the number of patterns
given to Match.

This change removes the TODO in log_buffer.go.
@kubernetes-prow kubernetes-prow Bot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 20, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @DigitalVeer. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubernetes-prow kubernetes-prow Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 20, 2026
@kubernetes-prow
kubernetes-prow Bot requested review from dchen1107 and sjenning July 20, 2026 23:21
@kubernetes-prow kubernetes-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 20, 2026
@wangzhen127

Copy link
Copy Markdown
Member

/ok-to-test

@kubernetes-prow kubernetes-prow Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 21, 2026

@hakman hakman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @DigitalVeer, LGTM!

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 22, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: DigitalVeer, hakman

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

The pull request process is described here

Details 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

@kubernetes-prow kubernetes-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 22, 2026
@hakman

hakman commented Jul 22, 2026

Copy link
Copy Markdown
Member

/test pull-npd-build

@kubernetes-prow
kubernetes-prow Bot merged commit 3b47d53 into kubernetes:master Jul 22, 2026
15 checks passed
@DigitalVeer
DigitalVeer deleted the logbuffer-regexp-cache branch July 22, 2026 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants