Use frozen strings for performance

require 'benchmark'


n = 10_000_000

Benchmark.bm(14) do |x|

  def render_header(output = [])
    output << "%PDF-1.0\n"

    # 4 binary chars, as recommended by the spec
    output << "%\xFF\xFF\xFF\xFF\n"
  end

  def render_header_frozen(output = [])
    output << "%PDF-1.0\n".freeze

    # 4 binary chars, as recommended by the spec
    output << "%\xFF\xFF\xFF\xFF\n".freeze
  end


  x.report("render"){
    n.times do
      render_header
    end
  }

  x.report("render frozen"){
    n.times do
      render_header_frozen
    end
  }

end
------------------------------------

                     user     system      total        real
render           3.588000   0.000000   3.588000 (  3.600590)
render frozen    1.934000   0.000000   1.934000 (  1.921306)