Created
September 23, 2009 10:50
-
-
Save maxlapshin/191914 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'benchmark' | |
| Benchmark.bm do |x| | |
| x.report("200 000") do | |
| File.open("out.xml", "w+") do |f| | |
| f << <<-EOF | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <feed xml:lang="en-US" xmlns:app="http://www.w3.org/2007/app" xmlns="http://www.w3.org/2005/Atom"> | |
| <id>tag:www.shop.ru,2005:/yamarket</id> | |
| <title>Yandex market</title> | |
| <updated>2009-09-16T13:30:45Z</updated> | |
| EOF | |
| 200_000.times do |i| | |
| f << <<-EOF | |
| <entry> | |
| <id>tag:www.shop.ru,2005:Good/#{i}</id> | |
| <published>2009-09-16T13:05:25Z</published> | |
| <title>Good №#{i}</title> | |
| <content><a href="http://shop.ru/good/#{i}">Good №#{i}</a></content> | |
| </entry> | |
| EOF | |
| end | |
| f << "</feed>\n" | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment