A C-optimized Ruby gem providing a faster implementation of Active Support's String#blank? method.
fast_blank is a Ruby C extension that provides a highly optimized implementation of the `String#blank?` method, which checks if a string is empty or contains only whitespace. It solves the performance bottleneck of repeatedly checking string emptiness in Ruby applications by offering significantly faster execution times compared to Active Support's standard implementation.
Ruby developers working on performance-sensitive applications, particularly those using Active Support's `String#blank?` method extensively in loops, validations, or data processing pipelines.
Developers choose fast_blank for its substantial performance gains—up to 20x faster in some cases—and its zero-allocation design that reduces garbage collection pressure, making it an ideal drop-in replacement for Active Support's method without changing application code.
fast_blank is a Ruby C extension that delivers a high-performance alternative to Active Support's String#blank? method. It offers significant speed improvements while maintaining compatibility with Ruby's standard behavior for determining if a string is empty or contains only whitespace.
blank_as? method for 100% compatibility with Active Support's Unicode-aware blank? behavior.fast_blank prioritizes raw performance and minimal memory overhead while maintaining behavioral parity with Ruby's native string handling, making it an ideal drop-in replacement for performance-critical applications.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Benchmarks in the README show it's 1.2 to 20 times faster than Active Support's implementation, with speed improvements scaling based on string length.
It operates without allocating additional strings, reducing garbage collection overhead as explicitly mentioned in the README's performance notes.
Simply require 'fast_blank' or add it to the Gemfile; no code changes are needed for basic replacement of Active Support's method, making adoption straightforward.
Provides the blank_as? method for 100% compatibility with Active Support's Unicode-aware blank? behavior, ensuring parity when needed.
The standard blank? method does not recognize Unicode whitespace characters, forcing developers to use blank_as? for full compatibility, which adds complexity.
Only officially supports MRI Ruby 1.9.3 through 2.2 and Rubinius 2.x, which are legacy versions, severely limiting its use in modern Ruby applications.
As a C extension, it requires compilation during installation, which can fail on systems without proper build tools or in platform-restricted deployments.