Skip to content

Commit f0282eb

Browse files
committed
add performance comparison table
1 parent 11a7088 commit f0282eb

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ Fast query at scale a vast range of data, including web search results, flight s
1616

1717
## Installation
1818

19-
To achieve optimal performance, it is essential to have Ruby 3.1+ (preferably version 3.4) installed.
19+
To achieve optimal performance, it is essential to latest Ruby version installed on your system (Ruby 2.7+ is supported by 3.4 is recommended for [performance reason](#Performance-Comparison)).
2020

2121
| Older versions such as Ruby 1.9, 2.x, and JRuby are compatible with [serpapi older library](https://github.com/serpapi/google-search-results-ruby), which continues to function effectively. see [migration guide](#Migration-quick-guide) if you are using the older library.
2222

23+
2324
### Bundler
2425
```ruby
2526
gem 'serpapi', '~> 1.0.0'
@@ -1007,6 +1008,25 @@ pp results[:organic_results]
10071008
* source code: [spec/serpapi/client/example/example_search_yelp_spec.rb](https://github.com/serpapi/serpapi-ruby/blob/master/spec/serpapi/client/example/example_search_yelp_spec.rb)
10081009
see: [https://serpapi.com/yelp-search-api](https://serpapi.com/yelp-search-api)
10091010

1011+
## Performance Comparison
1012+
1013+
### Ruby 3.4.4 vs Ruby 2.7.8 Performance
1014+
1015+
| Metric | Ruby 2.7.8 | Ruby 3.4.4 | Improvement |
1016+
|--------|------------|------------|-------------|
1017+
| **SerpApi Non-Persistent** | 100.93 req/s | 114.97 req/s | **+13.9%** |
1018+
| **SerpApi Persistent** | 226.82 req/s | 255.07 req/s | **+12.4%** |
1019+
| **HTTP.rb Non-Persistent** | 270.62 req/s | 294.01 req/s | **+8.6%** |
1020+
| **HTTP.rb Persistent** | 347.04 req/s | 570.95 req/s | **+64.5%** |
1021+
1022+
### Key Takeaways
1023+
1. **Upgrade to Ruby 3.4.4**: Clear performance benefits across all scenarios
1024+
2. **Use Persistent Connections**: 2x+ performance improvement in most cases
1025+
3. **HTTP.rb Performance**: Particularly benefits from Ruby 3.4.4 with persistent connections
1026+
4. **SerpApi Optimization**: Shows consistent ~2.2x improvement with persistent connections regardless of Ruby version
1027+
1028+
The older library (google-search-results-ruby) was performing at 55 req/s on Ruby 2.7.8, which is 2x slower than the current version (serpapi-ruby) on Ruby 3.4.4.
1029+
10101030
## Migration quick guide
10111031

10121032
if you were already using (google-search-results-ruby gem)[https://github.com/serpapi/google-search-results-ruby], here are the changes.

README.md.erb

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ Fast query at scale a vast range of data, including web search results, flight s
3636

3737
## Installation
3838

39-
To achieve optimal performance, it is essential to have Ruby 3.1+ (preferably version 3.4) installed.
39+
To achieve optimal performance, it is essential to latest Ruby version installed on your system (Ruby 2.7+ is supported by 3.4 is recommended for [performance reason](#Performance-Comparison)).
4040

4141
| Older versions such as Ruby 1.9, 2.x, and JRuby are compatible with [serpapi older library](https://github.com/serpapi/google-search-results-ruby), which continues to function effectively. see [migration guide](#Migration-quick-guide) if you are using the older library.
4242

43+
4344
### Bundler
4445
```ruby
4546
gem 'serpapi', '~> 1.0.0'
@@ -422,6 +423,25 @@ see: [https://serpapi.com/yandex-search-api](https://serpapi.com/yandex-search-a
422423
<%= snippet('ruby', 'spec/serpapi/client/example/example_search_yelp_spec.rb') %>
423424
see: [https://serpapi.com/yelp-search-api](https://serpapi.com/yelp-search-api)
424425

426+
## Performance Comparison
427+
428+
### Ruby 3.4.4 vs Ruby 2.7.8 Performance
429+
430+
| Metric | Ruby 2.7.8 | Ruby 3.4.4 | Improvement |
431+
|--------|------------|------------|-------------|
432+
| **SerpApi Non-Persistent** | 100.93 req/s | 114.97 req/s | **+13.9%** |
433+
| **SerpApi Persistent** | 226.82 req/s | 255.07 req/s | **+12.4%** |
434+
| **HTTP.rb Non-Persistent** | 270.62 req/s | 294.01 req/s | **+8.6%** |
435+
| **HTTP.rb Persistent** | 347.04 req/s | 570.95 req/s | **+64.5%** |
436+
437+
### Key Takeaways
438+
1. **Upgrade to Ruby 3.4.4**: Clear performance benefits across all scenarios
439+
2. **Use Persistent Connections**: 2x+ performance improvement in most cases
440+
3. **HTTP.rb Performance**: Particularly benefits from Ruby 3.4.4 with persistent connections
441+
4. **SerpApi Optimization**: Shows consistent ~2.2x improvement with persistent connections regardless of Ruby version
442+
443+
The older library (google-search-results-ruby) was performing at 55 req/s on Ruby 2.7.8, which is 2x slower than the current version (serpapi-ruby) on Ruby 3.4.4.
444+
425445
## Migration quick guide
426446

427447
if you were already using (google-search-results-ruby gem)[https://github.com/serpapi/google-search-results-ruby], here are the changes.

0 commit comments

Comments
 (0)