#!/usr/bin/ruby require 'xml/simple' $stdout.sync = true stime = Time.now.to_f nums = 10000 # Watch the power (0..nums).each { |i| doc = XML::Simple.open(File.dirname($0) + "/EXAMPLE.xml") nodes = doc.root.find("/test/names/name[6]") nodes.first.parent.append_child("name", { "team" => 2 }, "Egon") nodes.clear print "#{i}/#{nums} runs#{13.chr}" if i%1000 == 0 } puts "#{nums} parses from a file and some work done: #{Time.now.to_f - stime} seconds"