ruby/benchmark/buffer_get.yml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 строки
658 B
YAML
Исходник Обычный вид История

prelude: |
# frozen_string_literal: true
Warning[:experimental] = false
string = "The quick brown fox jumped over the lazy dog."
buffer = IO::Buffer.for(string)
format = [:U32, :U32, :U32, :U32]
2021-07-02 13:41:16 +03:00
benchmark:
string.unpack1: |
[
string.unpack1("N"),
string.unpack1("N", offset: 4),
string.unpack1("N", offset: 8),
string.unpack1("N", offset: 12),
]
buffer.get_value: |
[
buffer.get_value(:U32, 0),
buffer.get_value(:U32, 4),
buffer.get_value(:U32, 8),
buffer.get_value(:U32, 12),
]
buffer.get_values: |
buffer.get_values(format, 0)
string.unpack: |
string.unpack("NNNN")