Browse Source

[rails] Use regular json serializer (#9389)

The regular json serializer should be about as fast as OJ, after some
recent performance improvements:
https://github.com/ruby/json/blob/master/CHANGES.md
Petrik de Heus 9 months ago
parent
commit
fb17d2ab8e

+ 0 - 1
frameworks/Ruby/rails/Gemfile

@@ -1,6 +1,5 @@
 source 'https://rubygems.org'
 source 'https://rubygems.org'
 
 
-gem 'oj', '~> 3.16'
 gem 'rails', '~> 7.2.0'
 gem 'rails', '~> 7.2.0'
 gem 'redis', '~> 5.0'
 gem 'redis', '~> 5.0'
 gem 'tzinfo-data'
 gem 'tzinfo-data'

+ 1 - 6
frameworks/Ruby/rails/Gemfile.lock

@@ -137,7 +137,7 @@ GEM
     irb (1.14.1)
     irb (1.14.1)
       rdoc (>= 4.0.0)
       rdoc (>= 4.0.0)
       reline (>= 0.4.2)
       reline (>= 0.4.2)
-    json (2.7.2)
+    json (2.8.1)
     kgio (2.11.4)
     kgio (2.11.4)
     localhost (1.3.1)
     localhost (1.3.1)
     logger (1.6.1)
     logger (1.6.1)
@@ -172,11 +172,7 @@ GEM
       racc (~> 1.4)
       racc (~> 1.4)
     nokogiri (1.16.7-x86_64-linux)
     nokogiri (1.16.7-x86_64-linux)
       racc (~> 1.4)
       racc (~> 1.4)
-    oj (3.16.6)
-      bigdecimal (>= 3.0)
-      ostruct (>= 0.2)
     openssl (3.2.0)
     openssl (3.2.0)
-    ostruct (0.6.0)
     pg (1.5.8)
     pg (1.5.8)
     process-metrics (0.3.0)
     process-metrics (0.3.0)
       console (~> 1.8)
       console (~> 1.8)
@@ -275,7 +271,6 @@ PLATFORMS
 DEPENDENCIES
 DEPENDENCIES
   agoo
   agoo
   falcon (~> 0.47)
   falcon (~> 0.47)
-  oj (~> 3.16)
   pg (~> 1.5)
   pg (~> 1.5)
   puma (~> 6.4)
   puma (~> 6.4)
   rackup
   rackup

+ 1 - 1
frameworks/Ruby/rails/app/controllers/json_controller.rb

@@ -4,6 +4,6 @@ class JsonController < ApplicationControllerMetal
   def index
   def index
     add_headers
     add_headers
     self.content_type = 'application/json'
     self.content_type = 'application/json'
-    self.response_body = Oj.dump({ 'message' => 'Hello, World!' })
+    self.response_body = { 'message' => 'Hello, World!' }.to_json
   end
   end
 end
 end

+ 0 - 1
frameworks/Ruby/rails/config/initializers/oj.rb

@@ -1 +0,0 @@
-Oj.optimize_rails