Skip to content

Commit bf88e96

Browse files
committed
Add String#inspect benchmark
(cherry picked from commit 893ebd4)
1 parent 436518f commit bf88e96

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

bench/micro/string/inspect.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved. This
2+
# code is released under a tri EPL/GPL/LGPL license. You can use it,
3+
# redistribute it and/or modify it under the terms of the:
4+
#
5+
# Eclipse Public License version 2.0, or
6+
# GNU General Public License version 2, or
7+
# GNU Lesser General Public License version 2.1.
8+
9+
result = ""
10+
simple = "abcdefghij\nklmnopqrst\nuvwxyz"
11+
utf8 = "abçdéfghîĵ\nklmñöpqrst\nuvwxyz"
12+
13+
benchmark "core-string-inspect-simple" do
14+
result = simple.inspect
15+
end
16+
17+
benchmark "core-string-inspect-utf8" do
18+
result = utf8.inspect
19+
end

0 commit comments

Comments
 (0)