prawnpdf/prawn

View on GitHub
bench/ttf_text_bench.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

$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 do
      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
    end.render
  end
end