File: benchmark.rb

package info (click to toggle)
ruby-htmlentities 4.3.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 316 kB
  • sloc: ruby: 2,235; makefile: 3
file content (13 lines) | stat: -rw-r--r-- 335 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
# encoding: UTF-8
$KCODE = 'u' unless "1.9".respond_to?(:encoding)

require File.expand_path("../performance", __FILE__)
require "benchmark"

job = HTMLEntitiesJob.new
job.all(100) # Warm up to give JRuby a fair shake.

Benchmark.benchmark do |b|
  b.report("Encoding"){ job.encode(100) }
  b.report("Decoding"){ job.decode(100) }
end