Categories
Archives
- March 2010 (1)
- January 2009 (1)
- November 2008 (4)
- October 2008 (4)
- September 2008 (1)
- August 2008 (4)
- July 2008 (4)
- June 2008 (1)
- May 2008 (1)
- April 2008 (2)
- February 2008 (2)
- January 2008 (4)
- December 2007 (1)
- September 2007 (1)
- July 2007 (4)
- June 2007 (7)
- May 2007 (5)
- April 2007 (2)
- March 2007 (1)
- January 2007 (1)
- August 2006 (5)
Tags
- accident aging amanda animals art backup bald benchmark birds bizarre blood cake caligola car clothes debian dell dof dog bite dogs filesystems fotozondagavond garden hair holiday house injury insects italy leak linux luxury metal multimedia music nature nvidia perl pets presidents privacy programming pusa running sofia sound source spelling spiders sports spring surgery suspend sysadmin test thailand unix vampires vijntje water xml youth sentiment
Links
XML::Parser or XML::LibXML?
August 28th, 2008
That’s an easy question to answer: XML::LibXML!
I have over 10,000 lines of XML input. Parsing it into a tree with XML::Parser takes about 0.77 seconds, while XML::LibXML is over ten times faster, clocking in at 0.07 seconds.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
usr/bin/perl
use strict;
use Benchmark qw( cmpthese timethese :hireswallclock );
use XML::Parser;
use XML::LibXML;
sub xml_parser {
my $p1 = new XML::Parser(Style => 'Tree');
my $tree = $p1->parsefile('database.xml');
}
sub xml_libxml {
my $p1 = new XML::LibXML;
my $tree = $p1->parse_file('database.xml');
}
my $results = timethese(15,
{
'XML::LibXML' => \&xml_libxml,
'XML::Parser' => \&xml_parser,
},
'noc',
);
print "\n";
cmpthese($results);
|
The results are pretty damning:
XML::LibXML: 1.06607 wallclock secs ( 1.01 usr + 0.03 sys = 1.04 CPU) @ 14.42/s (n=15)
XML::Parser: 11.5305 wallclock secs ( 9.20 usr + 1.14 sys = 10.34 CPU) @ 1.45/s (n=15)
Rate XML::Parser XML::LibXML
XML::Parser 1.31/s -- -91%
XML::LibXML 14.4/s 1005% --
Now it’s off to write a schema for our wondrous XML dialect.
Fotozondagavond #37: Scary/Creepy/Narrow ("Eng")
August 19th, 2008
I figured I’d find some spiders and do a close-up of them, but then I realised they don’t scare me at all. Death does scare me a bit, but the Grim Reaper was not willing to pose.
In any case, last week we did have something that classifies as scary as well as narrow…
Take a look at this:
This is what Betta discovered last week when cleaning out one of our wardrobes. Note that the carpet and chipboard have already been removed here: the water had soaked through those and created mouldy patches. On first inspection we suspected a leaky pipe in the wall, but that wasn’t the problem.
I decided to take a peek under the floor in the crawl space (click to enlarge):
Yep, the water from this tiny leak had been spraying against the bottom of our floor for who knows how long, soaking the wooden beams thoroughly.
Fortunately, a plumber was able to fix it in no time and now we have to wait for the floor to dry before we can cover it again.
Also, the plumber mentioned that the only piece of lead pipe we still have is from the front door to that leak. The rest (including the pipe going up to the other appartments) is already made of copper. So replacing that piece of lead is going to be relatively painless and quick.
Fotozondagavond #36: Still Life
August 19th, 2008
Late again.
Anyway, you can’t get any stiller than a cat. :-)
Ok, ok, here’s some more “real” still life…
More stillness:
Fotozondagavond #35: Depth of Field (DOF)
August 8th, 2008
Sunday? More like Friday. Yeah, I’m late.
A wet day last week:
Large aperture, close-up, click, click. Low DOF.
More (or less) DoF at:



