The re2 Ruby gem version 2.27.0 releases concurrent matching by releasing the Ruby Global VM Lock (GVL) during regex operations including RE2::Regexp matching, RE2::Set compiled matching, and replace/extract operations. This allows other threads to run concurrently during potentially expensive matches, resulting in near-linear scaling with thread count. Benchmark results on an M1 Max show 8-thread matching completing in ~0.11s vs ~0.83s in the previous version. To support this, RE2::Regexp objects are now frozen on initialization, RE2::Set objects are frozen when compiled, and the extension is marked safe for Ractors. The GVL release is not available on Windows due to mutex conflicts with Abseil.

2m read timeFrom github.com
Post cover image
Table of contents
Changed

Sort: