From 78af6062bb656e87e2cd5adc5d372c41025869e6 Mon Sep 17 00:00:00 2001 From: Dong Yuwei Date: Tue, 1 Apr 2014 15:10:14 +0800 Subject: [PATCH] replace *json* gem by *yajl-ruby* to speed up json encode and decode --- Gemfile | 2 +- Gemfile.lock | 4 ++-- app.rb | 2 +- comments.rb | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 07cb31f..9edc6fa 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ ruby '1.9.3' gem 'sinatra','~> 1.4.2' gem 'redis','~> 3.0.4' gem 'hiredis', '~> 0.4.5' -gem 'json', '~> 1.7.7' +gem 'yajl-ruby', '~> 1.2.0' gem 'ruby-hmac', '~> 0.4.0' group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index 65b455b..7c37dc2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,6 @@ GEM specs: diff-lcs (1.2.5) hiredis (0.4.5) - json (1.7.7) rack (1.5.2) rack-protection (1.5.1) rack @@ -25,16 +24,17 @@ GEM rack-protection (~> 1.4) tilt (~> 1.3, >= 1.3.4) tilt (1.4.1) + yajl-ruby (1.2.0) PLATFORMS ruby DEPENDENCIES hiredis (~> 0.4.5) - json (~> 1.7.7) rack-test rake redis (~> 3.0.4) rspec ruby-hmac (~> 0.4.0) sinatra (~> 1.4.2) + yajl-ruby (~> 1.2.0) diff --git a/app.rb b/app.rb index c5cfaf9..5abf17e 100644 --- a/app.rb +++ b/app.rb @@ -31,7 +31,7 @@ require 'redis' require_relative 'page' require 'sinatra' -require 'json' +require 'yajl/json_gem' require 'digest/sha1' require 'digest/md5' require_relative 'comments' diff --git a/comments.rb b/comments.rb index 8e59c90..9d9f437 100644 --- a/comments.rb +++ b/comments.rb @@ -26,7 +26,7 @@ # policies, either expressed or implied, of Salvatore Sanfilippo. require 'rubygems' -require 'json' +require 'yajl/json_gem' class RedisComments def initialize(redis,namespace,sort_proc=nil)