Skip to content

Instantly share code, notes, and snippets.

@pnorman
Created June 2, 2016 05:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pnorman/5961c1f44bea71a472dce6732d723746 to your computer and use it in GitHub Desktop.
Save pnorman/5961c1f44bea71a472dce6732d723746 to your computer and use it in GitHub Desktop.
--[[
This script calls the tag transform functions to profile their performance
]]--
require("../openstreetmap-carto")
-- repeatable runs
math.randomseed(0)
for i = 1, 10 do
local tags = {}
local numtags = 0
if math.random() < 0.395 then
tags["source"] = "foo"
numtags = numtags + 1
if math.random() < 0.22 then
tags["source:date"] = "123456"
numtags = numtags + 1
end
end
if math.random() < 0.333 then
tags["addr:housenumber"] = "1a"
tags["addr:street"] = "Main Street"
tags["addr:city"] = "Manhatten"
numtags = numtags + 3
end
if math.random() < 0.116 then
tags["created_by"] = "JOSM"
numtags = numtags + 1
end
if math.random() < 0.111 then
tags["name"] = "bar"
numtags = numtags + 1
end
if math.random() < 0.105 then
if math.random() < .75 then
tags["power"] = "tower"
numtags = numtags + 1
else
tags["power"] = "pole"
numtags = numtags + 1
end
end
if math.random() < 0.070 then
tags["natural"] = "tree"
numtags = numtags + 1
end
if math.random() < 0.064 then
tags["highway"] = "foo"
numtags = numtags + 1
end
if math.random() < 0.052 then
tags["amenity"] = "bar"
numtags = numtags + 1
end
if math.random() < 0.040 then
tags["attribution"] = "baz"
numtags = numtags + 1
end
filter_tags_node(tags, numtags)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment