require 'xtemplate'

XTemplate::use_simple_expand()

MAX = (ARGV[0] || "150").to_i
xt_data = "foo"
text    = ""
for i in 0..MAX
  xt_data = {"foo" => xt_data}
  text    = "<tag id=\"foo\">#{text}</tag>"
end

t = XTemplate::XMLTemplate.new(text)
t1 = Time.now
t.expand2($stdout, xt_data)
t2 = Time.now
$stderr.puts t2 - t1
