зеркало из https://github.com/github/ruby.git
20 строки
353 B
YAML
20 строки
353 B
YAML
prelude: |
|
|
def def_array(size)
|
|
Object.class_eval(<<-END)
|
|
def array_#{size}
|
|
x = 1
|
|
[#{(['x'] * size).join(',')}]
|
|
end
|
|
END
|
|
end
|
|
def_array(100)
|
|
def_array(1000)
|
|
def_array(10000)
|
|
def_array(100000)
|
|
benchmark:
|
|
array_100: array_100
|
|
array_1000: array_1000
|
|
array_10000: array_10000
|
|
array_100000: array_100000
|
|
|