main.rb
require 'securerandom'
require 'benchmark'
# Generate some random bytes as an array of numbers
payload = SecureRandom.bytes(16 * 1024).unpack('C*')
# 10 thousand times converting calling pack
puts "Running benchmark, this may take a while"
r = Benchmark.measure { 10000.times { payload.pack('C*') } }
puts "Total time: #{r.total}s"