Skip to content

Instantly share code, notes, and snippets.

@mstepniowski
Created December 8, 2008 14:18
Show Gist options
  • Save mstepniowski/33463 to your computer and use it in GitHub Desktop.
Save mstepniowski/33463 to your computer and use it in GitHub Desktop.
# Ruby
[zuber@fish Projekty]$ ruby -v
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
[zuber@fish Projekty]$ time ruby test.rb > /dev/null
real 0m33.294s
user 0m31.745s
sys 0m0.303s
# Python
[zuber@fish Projekty]$ python -V
Python 2.5.1
[zuber@fish Projekty]$ time python test.py > /dev/null
real 0m4.995s
user 0m4.854s
sys 0m0.058s
# Python po zmianie modułu etree na napisany w C
# (from xml.etree import cElementTree as etree)
[zuber@fish Projekty]$ time python test.py > /dev/null
real 0m0.918s
user 0m0.671s
sys 0m0.045s
from xml.etree import ElementTree as etree
st = 5000
for i in range(100):
for j in range(st):
d = etree.Element('GoogleCustomizations')
etree.SubElement(d, 'Annotations')
d = r = None
print i * st
require 'rexml/document'
include REXML
st=5000
(0..100).each { |i|
(0..st).each { |j|
d = Document.new
r = d.add_element 'GoogleCustomizations'
r << Element.new('Annotations')
# d = '<GoogleCustomizations><Annotations></GoogleCustomizations>'
d,r=nil
}
puts i*st
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment