Sha256: 85e7af2db8c3613cd4f095bddc7cd8c528a3ffdcd32571b8a2eed2ea1fcb75a4

Contents?: true

Size: 675 Bytes

Versions: 38

Compression:

Stored size: 675 Bytes

Contents

require "benchmark"
require_relative "../lib/rust_blank"

n = 1_000_000
Benchmark.bmbm do |x|
  x.report("empty") do
    n.times {"".blank?}
  end

  x.report("blank") do
    n.times {" ".blank?}
  end

  x.report("present") do
    n.times {"x".blank?}
  end

  x.report("lots of spaces blank") do
    n.times {"                                          ".blank?}
  end

  x.report("lots of spaces present") do
    n.times {"                                          x".blank?}
  end

  x.report("blank US-ASCII") do
    s = " ".encode("US-ASCII")
    n.times {s.blank?}
  end

  x.report("blank non-utf-8") do
    s = " ".encode("UTF-16LE")
    n.times {s.blank?}
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/magnus-0.7.1/examples/rust_blank/test/bench.rb
wasmtime-28.0.0 ./ext/cargo-vendor/magnus-0.7.1/examples/rust_blank/test/bench.rb
wasmtime-27.0.0 ./ext/cargo-vendor/magnus-0.7.1/examples/rust_blank/test/bench.rb
wasmtime-26.0.0 ./ext/cargo-vendor/magnus-0.7.1/examples/rust_blank/test/bench.rb
wasmtime-25.0.2 ./ext/cargo-vendor/magnus-0.6.4/examples/rust_blank/test/bench.rb
wasmtime-25.0.1 ./ext/cargo-vendor/magnus-0.6.4/examples/rust_blank/test/bench.rb
wasmtime-25.0.0 ./ext/cargo-vendor/magnus-0.6.4/examples/rust_blank/test/bench.rb
wasmtime-24.0.0 ./ext/cargo-vendor/magnus-0.6.4/examples/rust_blank/test/bench.rb
wasmtime-23.0.2 ./ext/cargo-vendor/magnus-0.6.4/examples/rust_blank/test/bench.rb
wasmtime-22.0.0 ./ext/cargo-vendor/magnus-0.6.4/examples/rust_blank/test/bench.rb
wasmtime-21.0.1 ./ext/cargo-vendor/magnus-0.6.4/examples/rust_blank/test/bench.rb
wasmtime-20.0.2 ./ext/cargo-vendor/magnus-0.6.4/examples/rust_blank/test/bench.rb
wasmtime-20.0.0 ./ext/cargo-vendor/magnus-0.6.4/examples/rust_blank/test/bench.rb
wasmtime-18.0.3 ./ext/cargo-vendor/magnus-0.6.2/examples/rust_blank/test/bench.rb
wasmtime-17.0.1 ./ext/cargo-vendor/magnus-0.6.2/examples/rust_blank/test/bench.rb
wasmtime-17.0.0 ./ext/cargo-vendor/magnus-0.6.2/examples/rust_blank/test/bench.rb
wasmtime-16.0.0 ./ext/cargo-vendor/magnus-0.6.2/examples/rust_blank/test/bench.rb
wasmtime-15.0.1 ./ext/cargo-vendor/magnus-0.6.2/examples/rust_blank/test/bench.rb
wasmtime-15.0.0 ./ext/cargo-vendor/magnus-0.6.2/examples/rust_blank/test/bench.rb
wasmtime-14.0.4 ./ext/cargo-vendor/magnus-0.5.5/examples/rust_blank/test/bench.rb