File: ttf_text_bench.rb

package info (click to toggle)
ruby-prawn 1.3.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,936 kB
  • ctags: 802
  • sloc: ruby: 13,906; sh: 43; makefile: 15
file content (21 lines) | stat: -rw-r--r-- 433 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# encoding: utf-8

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require "prawn"
require "benchmark"

N=2000

Benchmark.bmbm do |x|
  x.report("TTF text") do
    Prawn::Document.new {
       font "#{Prawn::DATADIR}/fonts/DejaVuSans.ttf"
       N.times do
         (1..5).each do |i|
           draw_text "Hello Prawn", :at => [200, i * 100]
         end
         start_new_page
       end
    }.render
  end
end