Subject: | Very slow parsing |
Email::Simple seems very slow at building the headers from a normal,
25-line e-mail header: it clocks at about 5 messages parsed per second.
I tested this on a 3.2GHz Pentium running RHEL, and on a 1.8GHz Pentium
M running Windows XP. Benchmark attached.
Hope that helps,
Dan Dascalescu
Subject: | Email-Simple.pl |
#!/usr/bin/perl -w
use strict;
use Email::Simple;
use Benchmark ':hireswallclock';
my $header = [
'Delivered-To:',
'Return-Path: <nospam@arcor.de>',
'Received: from mail-in-04.arcor-online.net (mail-in-04.arcor-online.net [151.189.21.44])',
' by mrin1.yahoo.com (8.13.8/8.13.8/y.in) with ESMTP id l3D2Pbrm088969',
' for <nospam@yahoo.com>; Thu, 12 Apr 2007 19:25:37 -0700 (PDT)',
'Received: from mail-in-01-z2.arcor-online.net (mail-in-11-z2.arcor-online.net [151.189.8.28])',
' by mail-in-04.arcor-online.net (Postfix) with ESMTP id 495C117F670',
' for <nospam@yahoo.com>; Fri, 13 Apr 2007 04:25:34 +0200 (CEST)',
'Received: from mail-in-07.arcor-online.net (mail-in-07.arcor-online.net [151.189.21.47])',
' by mail-in-11-z2.arcor-online.net (Postfix) with ESMTP id 3D183347328',
' for <nospam@yahoo.com>; Fri, 13 Apr 2007 04:25:34 +0200 (CEST)',
'Received: from webmail16 (webmail16.arcor-online.net [151.189.8.70])',
' by mail-in-07.arcor-online.net (Postfix) with ESMTP id 30E4D2C29E1',
' for <nospam@yahoo.com>; Fri, 13 Apr 2007 04:25:34 +0200 (CEST)',
'Message-ID: <8531504.1176431134185.JavaMail.ngmail@webmail16>',
'Date: Fri, 13 Apr 2007 04:25:34 +0200 (CEST)',
'From: nospam@arcor.de',
'To: nospam@yahoo.com',
'Subject: Email::Simple speed test',
'MIME-Version: 1.0',
'Content-Type: text/plain; charset=ISO-8859-1',
'Content-Transfer-Encoding: quoted-printable',
'X-ngMessageSubType: MessageSubType_MAIL',
'X-WebmailclientIP: 1.2.3.4',
'X-Spam-Track: [cat=UK; info=ip:NN<ip=151.189.21.44,policy=n-w0,n100,g0,s>;sv:UK<ip=66.218.86.238>;sg:UK<size=8,cnt=0>]',
];
@$header = map {$_.="\n"} @$header;
my $t = timeit(10, sub {
my $es = Email::Simple->new(join '', @{$header} );
my $s = $es->header("Subject");
});
print "10 loops of other code took:", timestr($t),"\n";