Add pattern matching with arrays benchmark

This commit is contained in:
Vladimir Dementyev 2020-03-03 18:45:57 -05:00 коммит произвёл Kazuki Tsujimoto
Родитель d6c9c014e2
Коммит 6770d8f1b0
1 изменённых файлов: 19 добавлений и 0 удалений

19
benchmark/pm_array.yml Normal file
Просмотреть файл

@ -0,0 +1,19 @@
prelude: |
def call(*val)
case val
in [String => body]
[200, {}, [body]]
in [Integer => status]
[status, {}, [""]]
in [Integer, String] => response
[response[0], {}, [response[1]]]
in [Integer, Hash, String] => response
[response[0], response[1], [response[2]]]
end
end
benchmark:
first_match: call("ok")
second_match: call(401)
third_match: call(200, "ok")
fourth_match: call(201, {}, "created")