Created
June 13, 2016 02:39
-
-
Save tanner0101/007a69f019796eb1f157ffc911d6aa7c to your computer and use it in GitHub Desktop.
Rails Benchmark
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BenchmarkController < ActionController::Base | |
def plaintext | |
render plain: "Hello world" | |
end | |
def json | |
a = [1, 2, 3] | |
d = {"one" => 1, "two" => 2, "three" => 3} | |
r = {"array" => a, "dict" => d, "int" => 42, "string" => "test", "double" => 3.14, "null" => nil} | |
render :json => r | |
end | |
def sqlite | |
r = ActiveRecord::Base.connection.exec_query("SELECT * FROM users ORDER BY random() LIMIT 1") | |
render :json => r | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment