Skip to content

feat: replace JMH with lightweight timing-based benchmarks#503

Merged
nomeguy merged 3 commits intomasterfrom
copilot/remove-jmh-dependencies
Jan 23, 2026
Merged

feat: replace JMH with lightweight timing-based benchmarks#503
nomeguy merged 3 commits intomasterfrom
copilot/remove-jmh-dependencies

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

fix: #502

Removes OpenJDK JMH dependencies (jmh-core, jmh-generator-annprocess) and replaces with a simple timing utility for benchmark tests.

Changes

  • BenchmarkUtil: New utility class providing warmup/measurement phases with System.nanoTime() timing and throughput calculation
  • Benchmark tests: Converted 4 test classes (46 benchmarks total) from JMH annotations to JUnit tests with timing wrapper

Example

Before (JMH):

@Benchmark
public void benchmarkRBACModel() {
    Enforcer e = new Enforcer("examples/rbac_model.conf", "examples/rbac_policy.csv");
    e.enforce("alice", "data2", "read");
}

After (BenchmarkUtil):

@Test
public void benchmarkRBACModel() {
    BenchmarkUtil.runBenchmark("RBAC Model", () -> {
        Enforcer e = new Enforcer("examples/rbac_model.conf", "examples/rbac_policy.csv");
        e.enforce("alice", "data2", "read");
    });
}

Output format remains similar (iterations, duration, ops/sec) with default 3 warmup + 5 measurement iterations.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@nomeguy nomeguy marked this pull request as ready for review January 22, 2026 18:56
@codecov-commenter
Copy link

codecov-commenter commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.08%. Comparing base (eb4476f) to head (bdf68c0).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #503      +/-   ##
==========================================
+ Coverage   67.92%   68.08%   +0.16%     
==========================================
  Files          63       63              
  Lines        3083     3083              
  Branches      574      574              
==========================================
+ Hits         2094     2099       +5     
+ Misses        805      801       -4     
+ Partials      184      183       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI and others added 2 commits January 22, 2026 19:02
Co-authored-by: nomeguy <85475922+nomeguy@users.noreply.github.com>
Co-authored-by: nomeguy <85475922+nomeguy@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove JMH dependencies and replace with alternatives Replace JMH with lightweight timing-based benchmarks Jan 22, 2026
Copilot AI requested a review from nomeguy January 22, 2026 19:09
@nomeguy nomeguy changed the title Replace JMH with lightweight timing-based benchmarks feat: replace JMH with lightweight timing-based benchmarks Jan 23, 2026
@nomeguy nomeguy merged commit 9249973 into master Jan 23, 2026
1 of 3 checks passed
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.

[feature] replace jmh with others

4 participants