Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruleguard: introduce reusable runner state #415

Merged
merged 1 commit into from
Oct 2, 2022

Conversation

quasilyte
Copy link
Owner

This allows more memory reuse between ruleguard engine executions.

Usually, app only needs one Engine object, which doesn't require any synchronization. For optimal execution, there should be N RunnerState objects, where N is number of concurrently executing goroutines that use same Engine.

name         old time/op    new time/op    delta
EngineRun-8     231µs ± 1%     197µs ± 0%  -14.72%  (p=0.000 n=9+10)
Issue412-8      205µs ± 1%     196µs ± 1%   -4.46%  (p=0.000 n=10+10)

name         old alloc/op   new alloc/op   delta
EngineRun-8    23.5kB ± 0%     9.1kB ± 0%  -61.26%  (p=0.000 n=8+8)
Issue412-8     9.54kB ± 0%    1.81kB ± 0%  -81.03%  (p=0.000 n=8+7)

This allows more memory reuse between ruleguard engine executions.

Usually, app only needs one Engine object, which doesn't require
any synchronization. For optimal execution, there should be
N `RunnerState` objects, where N is number of concurrently executing
goroutines that use same `Engine`.

    name         old time/op    new time/op    delta
    EngineRun-8     231µs ± 1%     197µs ± 0%  -14.72%  (p=0.000 n=9+10)
    Issue412-8      205µs ± 1%     196µs ± 1%   -4.46%  (p=0.000 n=10+10)

    name         old alloc/op   new alloc/op   delta
    EngineRun-8    23.5kB ± 0%     9.1kB ± 0%  -61.26%  (p=0.000 n=8+8)
    Issue412-8     9.54kB ± 0%    1.81kB ± 0%  -81.03%  (p=0.000 n=8+7)
@quasilyte quasilyte merged commit 9af9b08 into master Oct 2, 2022
@quasilyte quasilyte deleted the quasilyte/introduce_runner_state branch October 2, 2022 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant