published on 18.03.2007 11:20.

ruby: performance comparison of rexml and libxml

update: here’s the same for PHP’s XML Parser.

a quick comparison of the two libraries available for processing XML in ruby shows dramatic performance differences.

am i missing something, is there a fundamental flaw in the test? of course REXML is pure ruby, while libxml is C; but can the difference really be so huge?

loading an xml file

file size libxml REXML factor
10KB 0,83 39,17 47,0
100KB 6,67 306,56 46,0
1.6MB 71,88 3954,21 55,0

simple xpath expression

file size libxml REXML factor
10KB 0,12 124,68 1004,7
100KB 0,67 678,11 1016,8
1.6MB 6,21 22578,18 3633,6

the test code

def benchmark
   start = Time.new.to_f
   10.times { yield }
   puts ((Time.new.to_f - start) / 10) * 1000
end

doc = nil

# exclude the effect of filesystem caching (makes sense?)
File.read('products.xml')

#
# libxml
#
require 'rubygems'
require 'xml/libxml'

benchmark do
   doc = XML::Document.file("products.xml")
end

benchmark do
   doc.find('//articles/article/shortdesc').each do |node|
      #puts node.content
   end
end

#
# rexml
#
require "rexml/document"

benchmark do
   doc = REXML::Document.new File.read("products.xml")
end

benchmark do
   doc.elements.each("//articles/article/shortdesc") do |node| 
      #puts node.text
   end
end

Posted in , ,  | Tags , , , ,  | no comments

published on 10.03.2007 20:27.

Does Marcellus Wallace look like a bitch?

wonderful typography, animated.

via stefan tilkov and steve's new company's blog.

Tags ,  | no comments

published on 06.01.2007 16:09.

martian sunset

via graham glass.

Posted in  | no comments

published on 04.01.2007 00:19.

D programming language

“D is a systems programming language. Its focus is on combining the power and high performance of C and C++ with the programmer productivity of modern languages like Ruby and Python.”

that sounds interesting, gotta give it a spin! visit digitalmars for more info.

Posted in  | no comments

published on 31.12.2006 14:35.

apple macbooks performance comparison (with core 2 duos)

an update of the table found here, now includes the notebooks with core 2 duo processors. data still taken from macworld.

for now, too lazy to make a thumbnail - right click and “view image” for full size

Posted in  | no comments

published on 13.12.2006 17:12.

unix: finding files older than x days

find all files older than 60 days:

find /some/dir -atime +60

in combination with xargs this is very useful for removing old rails sessions:

find /u/apps/my_app/current/tmp/sessions/ -atime +60 | xargs rm

Posted in ,  | no comments

published on 22.11.2006 23:57.

signs you're a crappy programmer

an excellent post by Damien Katz. not really fresh, but really worth a read.

the first sign also brings to mind a favorite quote of mine:

«A language that doesn’t affect the way you think about programming is not worth knowing.»
— Alan Perlis

Posted in  | no comments

published on 22.09.2006 22:32.

smoke this.

the following code execudes just fine (the puts are executed in order 1-7, no parse errors). earns an anything-special-about-that? shrug from the ruby crowd, a highly disturbed look from everyone else (including me).

module Acid
    puts "1) My first Acid."    
    def self.append_features(mod)
        puts "4) Now #{mod.class}'s taken Acid."
        mod.extend(self)
    end
  end

class Bus
    puts "2) Now that's a boring bus."
end

class Furthur < Bus
    puts "3) First, setup the fuel."
    include Acid
    puts "5) Lets get on the magic bus."
    def initialize
        puts "6) A magic bus has been set up."
    end
    def play_hippie_music
        puts "7) Driving Home. That's it, folks!"
    end
end

magic_bus = Furthur.new
magic_bus.play_hippie_music

Posted in ,

published on 08.06.2006 13:45.

getting themes to work with typo trunk

the old web server is dying, so it was time to get a new one and move everything over. typo didn’t run in the new ruby/rails environment, so i decided to try updating to the latest svn trunk revision. it took some fiddling to get it to work, especially since i wanted to use a new theme – [Lucid Theme](http://typogarden.com/articles/2005/11/30/the-lucid-theme) by [Jamie Hill](http://www.thelucid.com/). the theme hasn’t been updated for some time, so (due to some changes in the handling of sidebars) it didn’t work with typo trunk. fak3r [researched](http://fak3r.com/articles/2006/06/05/howto-get-typo-themes-to-work-with-trunk) how to fix that – thanks!

note: there’s still some trouble with internet explorer on windows. i’ll look into that – and the flickr sidebar – later.

Posted in ,  | Tags , ,

published on 05.06.2006 20:22.

test your web-development knowledge

Posted in ,

Older posts: 1 ... 4 5 6 7 8