This file contains 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
# /tmp/test = EBS-SSD | |
# /ephemeral/test = instance-store | |
[root@ip-172-31-26-72 ec2-user]# dd bs=1M count=1024 if=/dev/zero of=/ephemeral/test | |
1024+0 records in | |
1024+0 records out | |
1073741824 bytes (1.1 GB) copied, 3.15671 s, 340 MB/s | |
[root@ip-172-31-26-72 ec2-user]# dd bs=1M count=1024 if=/dev/zero of=/ephemeral/test | |
1024+0 records in | |
1024+0 records out |
This file contains 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
require 'benchmark/ips' | |
require 'securerandom' | |
require 'digest' | |
NUMBER = 10_000 | |
id_array = Array.new(NUMBER) { SecureRandom.uuid }.freeze | |
def slow(array) | |
Digest::MD5.hexdigest(array.join('/')) |
This file contains 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
# ruby 2.3.3p222 | |
user system total real | |
YAML 31.860000 0.000000 31.860000 ( 31.886926) | |
JSON 1.370000 0.000000 1.370000 ( 1.374081) | |
Marshal 0.710000 0.000000 0.710000 ( 0.711384) | |
MessagePack 0.510000 0.000000 0.510000 ( 0.505674) | |
# jruby 9.1.7.0 (2.3.1) | |
user system total real | |
YAML 26.270000 0.040000 26.310000 ( 25.652204) |
This file contains 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
# EditorConfig helps developers define and maintain consistent | |
# coding styles between different editors and IDEs | |
# http://editorconfig.org | |
root = true | |
[*] | |
indent_style = space | |
indent_size = 2 | |
end_of_line = lf |
This file contains 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
# EditorConfig helps developers define and maintain consistent | |
# coding styles between different editors and IDEs | |
# http://editorconfig.org | |
root = true | |
[*] | |
indent_style = space | |
indent_size = 2 | |
end_of_line = lf |
This file contains 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
∫ ruby serialize_bench.rb | |
Rehearsal ------------------------------------------- | |
json 0.170000 0.010000 0.180000 ( 0.174912) | |
yaml 6.350000 0.000000 6.350000 ( 6.353721) | |
marshal 0.170000 0.000000 0.170000 ( 0.171184) | |
bson 0.210000 0.000000 0.210000 ( 0.213753) | |
yajl 0.130000 0.000000 0.130000 ( 0.130591) | |
oj 0.080000 0.000000 0.080000 ( 0.075798) | |
eval 0.370000 0.000000 0.370000 ( 0.370350) | |
---------------------------------- total: 7.490000sec |
This file contains 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
# config/application.rb | |
config.middleware.insert_after ActionDispatch::Flash, Warden::Manager do |manager| | |
manager.default_strategies :authentication_token, :basic_auth | |
manager.failure_app = UnauthorizedController | |
end |
This file contains 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
# config/application.rb | |
config.middleware.insert_after ActionDispatch::Flash, Warden::Manager do |manager| | |
manager.default_strategies :authentication_token | |
manager.failure_app = UnauthorizedController | |
end |
This file contains 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
# app/controllers/application_controller.rb | |
class ApplicationController < ActionController::API | |
include WardenHelper | |
end |
NewerOlder