• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gonzedge / rambling-trie / #380
100%
master: 100%

Build:
Build:
LAST BUILD BRANCH: main
DEFAULT BRANCH: master
Ran 02 Dec 2024 03:29PM UTC
Jobs 1
Files 27
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

02 Dec 2024 03:28PM UTC coverage: 100.0%. Remained the same
#380

push

web-flow
Disable garbage collection in benchmarks and add script to rapidly run benchmarks for any given version (#81)

## Solution

This PR:

1. Adds a benchmarking script leveraging the new `Dockerfile.benchmark`
added in #80
2. Ensures all benchmarks are run with garbage collection stopped via
    ```ruby
    ::GC.start # <= trigger garbage collection
    ::GC.disable # disable before executing benchmark
    yield
    ::GC.enable # enable after executing benchmark
    ```
    so that it doesn't interfere with benchmark calculations

## Background

After #80, I've been re-running some of the benchmarks. For the last few
hours, I suspected a change in #71 slowed things down in many methods.
After some up tinkering, it looked to me like the main culprit is the
block `do/end` => `{ }` change. However, I continued to get wildly
different results, and sometimes `{ }` would be faster than `do/end`, or
just as fast.

This was extremely confusing because running a benchmark even with a
bunch of nested blocks and closure variables, `do/end` and `{ }` report
as the same-ish:

```
# result from docker run -it rambling-trie:latest bash -c 'bundle exec rake ips:nested_do_end_vs_brackets'
ruby 3.3.6 (2024-11-05 revision 75015d4c1f) [aarch64-linux]
Warming up --------------------------------------
              do/end   312.000 i/100ms
                 { }   312.000 i/100ms
Calculating -------------------------------------
              do/end      3.113k (± 1.2%) i/s  (321.20 μs/i) -     62.400k in  20.046043s
                 { }      3.107k (± 1.7%) i/s  (321.84 μs/i) -     62.400k in  20.090024s

Comparison:
              do/end:     3113.4 i/s
                 { }:     3107.2 i/s - same-ish: difference falls within error
```

After some research and additional benchmarking, I finally figured it
out: THE VARIATIONS COME FROM GARBAGE COLLECTION!!!

Initially, this PR changed `{ }` blocks back to `do/end`, but after
running ... (continued)

535 of 535 relevant lines covered (100.0%)

1311.94 hits per line

Jobs
ID Job ID Ran Files Coverage
1 #380.1 02 Dec 2024 03:29PM UTC 27
100.0
Source Files on build #380
  • Tree
  • List 27
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • a8ef7ca1 on github
  • Prev Build on main
  • Next Build on main
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc