Tags / 19 posts
#ruby
2020 1 post
-
Hidden cost of string indexing in Ruby
Non-ASCII characters turn Ruby’s String#[] from O(1) into an O(n) scan, as benchmarks and MRI’s coderange string flag show.
2019 1 post
-
Testing Infinite Loop in Ruby
Unit test a worker built around Kernel#loop by extracting its body, then cutting the loop short with Timeout or stubbing loop in RSpec.
2018 1 post
-
How to fix intermittent test failures
Bisect a test run to find the test that leaks state, then fix flaky tests that rely on undefined ordering or on the current time.