Last active
May 1, 2019 01:23
-
-
Save jcoyne/8905114 to your computer and use it in GitHub Desktop.
Benchmark rails/rails#13919
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 'active_support' | |
require 'active_support/multibyte/unicode' | |
string = "有名人やアニメ、風景などいろいろな画像を探したいならYahoo!検索(画像)。サイズ別、色別での絞り込みが可能なだけでなく、スライドショー機能も搭載。加えて、今検索されているキーワードもリアルタイムでわかるので、話題の画像がチェックできます。" | |
require 'benchmark' | |
n = 1_000_000 | |
Benchmark.bmbm do |x| | |
x.report("for:") { for i in 1..n; ActiveSupport::Multibyte::Unicode.tidy_bytes(string); end } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output: