Skip to content

Commit 82b2fc4

Browse files
authored
[ruby/sinatra] Don't use JSON.fast_generate (#9521)
It's not faster for small payloads. +--------------------+------+-----+-----+-------+--------------+ | branch_name|update| db|query|fortune|weighted_score| +--------------------+------+-----+-----+-------+--------------+ | master| 8301|36433|15826| 28025| 1089| |remove-fast-generate| 8897|38895|16317| 27660| 1143| +--------------------+------+-----+-----+-------+--------------+
1 parent db4831a commit 82b2fc4

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

frameworks/Ruby/sinatra-sequel/Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ GEM
44
base64 (0.2.0)
55
bigdecimal (3.1.8)
66
iodine (0.7.58)
7-
json (2.8.2)
7+
json (2.9.1)
88
kgio (2.11.4)
99
mustermann (3.0.3)
1010
ruby2_keywords (~> 0.0.1)

frameworks/Ruby/sinatra-sequel/hello_world.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def bounded_queries
2222

2323
def json(data)
2424
content_type :json
25-
JSON.fast_generate(data)
25+
data.to_json
2626
end
2727

2828
# Return a random number between 1 and MAX_PK

frameworks/Ruby/sinatra/hello_world.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def bounded_queries
2222

2323
def json(data)
2424
content_type :json
25-
JSON.fast_generate(data)
25+
data.to_json
2626
end
2727

2828
# Return a random number between 1 and MAX_PK

0 commit comments

Comments
 (0)