File: benchmark.rb

package info (click to toggle)
ruby-htmlentities 4.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 308 kB
  • ctags: 123
  • sloc: ruby: 2,236; makefile: 2
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