diff --git a/CHANGELOG.md b/CHANGELOG.md index db811b77..c0c7d074 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Use native llhttp gem for MRI Ruby and llhttp-ffi for other interpreters for better performance + ### Removed - **BREAKING** Drop Ruby 2.x support diff --git a/http.gemspec b/http.gemspec index d11ee618..9dfdcf71 100644 --- a/http.gemspec +++ b/http.gemspec @@ -30,7 +30,13 @@ Gem::Specification.new do |gem| gem.add_runtime_dependency "addressable", "~> 2.8" gem.add_runtime_dependency "http-cookie", "~> 1.0" gem.add_runtime_dependency "http-form_data", "~> 2.2" - gem.add_runtime_dependency "llhttp-ffi", "~> 0.5.0" + + # Use native llhttp for MRI (more performant) and llhttp-ffi for other interpreters (better compatibility) + if RUBY_ENGINE == "ruby" + gem.add_runtime_dependency "llhttp", "~> 0.5.0" + else + gem.add_runtime_dependency "llhttp-ffi", "~> 0.5.0" + end gem.metadata = { "source_code_uri" => "https://github.com/httprb/http",