1
0
forked from Mirror/wren

Don't use string length in map benchmark (since it's slow now).

This commit is contained in:
Bob Nystrom
2015-09-12 09:59:30 -07:00
parent 92c2b2d5e0
commit e1f979e78a
5 changed files with 13 additions and 8 deletions

View File

@ -76,7 +76,7 @@ false""")
BENCHMARK("map_numeric", r"""500000500000""")
BENCHMARK("map_string", r"""3645600""")
BENCHMARK("map_string", r"""12799920000""")
BENCHMARK("string_equals", r"""3000000""")

View File

@ -80,9 +80,10 @@ end
local start = os.clock()
local map = {}
local i = 0
for _, key in ipairs(keys) do
map[key] = string.len(key)
map[key] = i
i = i + 1
end
local sum = 0

View File

@ -81,9 +81,10 @@ for animal in animals:
start = time.clock()
map = {}
i = 0
for key in keys:
map[key] = len(key)
map[key] = i
i += 1
sum = 0
for key in keys:

View File

@ -80,9 +80,10 @@ end
start = Time.now
map = Hash.new
i = 0
for key in keys
map[key] = key.length
map[key] = i
i += 1
end
sum = 0

View File

@ -81,8 +81,10 @@ var start = IO.clock
var map = {}
var i = 0
for (key in keys) {
map[key] = key.count
map[key] = i
i = i + 1
}
var sum = 0