DateTime Performance

2003-08-03 Thread John Siracusa
I was profiling a database-backed mod_perl application recently. A particular request was taking several seconds to complete. At first I thought the database was the bottleneck, but the request included only one database query, and that query completed in about 300msec when run from a command

DateTime performance

2005-01-22 Thread Daisuke Maki
I have a question on DateTime performance I really want to use DateTime in most of my projects, especially when I'm working with the likes of Class::DBI, to give the proper abstraction for handling TIMESTAMP/DATETIME fields, as well as the free validation I get from DateTime

DateTime performance

2006-01-17 Thread matthew
I don't consider this to be completely a DateTime issue however I thought I would share my findings to this list for consideration. I'm using the latest release of DateTime with perl 5.8 (Standard RPM distro) for FC4 on a very old 166MHz Pentium system. So I don't expect this system to fa

DateTime performance

2009-01-23 Thread arie . haan1
Hey! Why DateTime module is loaded so slow? This simple script that just imports DateTime is executed for 1 second approximately: use DateTime; Can I make it faster? Our project requres getting time-zone offset for the given time-zone id at the current time. This is the primary reason I use Dat

DateTime performance

2012-05-03 Thread Philipp K. Janert
Question: When using DateTime for a large number of instances, it becomes a serious performance drag. A typical application for me involves things like log files: I use DateTime to translate the timestamps in these files into a canonical format, and then get information such as "day-of-week"

Re: DateTime Performance

2003-08-03 Thread Dave Rolsky
On Sun, 3 Aug 2003, John Siracusa wrote: > CGI->new(''): 5 wallclock secs @ 1869.16/s >(5.25 usr + 0.10 sys = 5.35 CPU) CGI's constructor really doesn't do much at all, especially if there's no query string or form submission to handle. > Date::Simple->new('2003-01-01'): 2 wallclock secs

Re: DateTime Performance

2003-08-04 Thread John Siracusa
On 8/4/03 12:26 AM, Dave Rolsky wrote: >> # "..." includes args: year, month, day, hour, minute, second >> DateTime->new(...): 16 wallclock secs @ 687.29/s >>(14.48 usr + 0.07 sys = 14.55 CPU) > > This does a lot of work, including calculating both UTC & local times, > which involves calculat

Re: DateTime Performance

2003-08-04 Thread John Siracusa
On 8/4/03 10:10 AM, John Siracusa wrote: > On 8/4/03 12:26 AM, Dave Rolsky wrote: >>> # "..." includes args: year, month, day, hour, minute, second >>> DateTime->new(...): 16 wallclock secs @ 687.29/s >>>(14.48 usr + 0.07 sys = 14.55 CPU) >> >> This does a lot of work, including calculating b

Re: DateTime Performance

2003-08-04 Thread Ben Bennett
On Mon, Aug 04, 2003 at 10:10:54AM -0400, John Siracusa wrote: > > Does it need to do that? I mean, sure, eventually it might have to do that > if I want to do some sort of date manipulation, or even just fetch or print > the date. But does it have to really do anything at all during object > co

Re: DateTime Performance

2003-08-04 Thread John Siracusa
On 8/4/03 1:25 PM, Ben Bennett wrote: > Why not make your module be lazy about whether or not it creates a > DateTime? I thought of that, but I also use the act of creating a DateTime object to check the validity of date attributes. Anyway, I think there's room for DateTime->new() optimization ev

Re: DateTime Performance

2003-08-08 Thread Joshua Hoblitt
> > A solution that is more or less equivalent, is to change the > > DefaultLocale routine. [...] > > Probably this changes the behaviour if the default locale is aliased. > > But IMHO, that's probably for the better. > > Yeah, that was my concern: add_aliases() and friends in > DateTime::Locale wo

Re: DateTime Performance

2003-08-09 Thread John Siracusa
On Tuesday, August 5, 2003, at 01:26 PM, Eugene van der Pijll wrote: John Siracusa schreef: Okay, here's a simple implementation of a memoized DateTime::Locale::load(). A solution that is more or less equivalent, is to change the DefaultLocale routine. [...] Probably this changes the behaviour if t

Re: DateTime Performance

2003-08-09 Thread Eugene van der Pijll
John Siracusa schreef: > Okay, here's a simple implementation of a memoized > DateTime::Locale::load(). A solution that is more or less equivalent, is to change the DefaultLocale routine. At the moment, $DefaultLocale is saved as a string; every time DT::new() is called without a "locale" argumen

Re: DateTime Performance

2003-08-07 Thread Tim Bunce
On Mon, Aug 04, 2003 at 11:32:15PM -0500, Dave Rolsky wrote: > > > Maybe that looks more sane to you? > > What makes no sense is for BEGIN to show up as a significant chunk of the > time it would take to do anything, since this stuff should only happen > once. I'm somewhat skeptical that Devel::

Re: DateTime performance

2005-01-22 Thread John Siracusa
On 1/22/05 8:38 PM, Daisuke Maki wrote: > I really really want to make it faster. I know that it's impossible to > match sprintf + localtime, but wouldn't it be nice if the difference was > an order of magnitude lower... ;) > > So ... are we going to address this? I spent a little time seeing how

Re: DateTime performance

2006-01-17 Thread Jerrad Pierce
Unfortunately, it's a known problem that CentOS suffers from too (@[EMAIL PROTECTED]). This also makes reading error output incredibly difficult since a full screen is given to list @INC. Instead of a few folks who are upgrading systems having to set PERL5LIB everyone else has to recompile perl or

Re: DateTime performance

2006-01-17 Thread Roderick A. Anderson
Jerrad Pierce wrote: Unfortunately, it's a known problem that CentOS suffers from too (@[EMAIL PROTECTED]). This also makes reading error output incredibly difficult since a full screen is given to list @INC. Instead of a few folks who are upgrading systems having to set PERL5LIB everyone else h

Re: DateTime performance

2006-01-18 Thread Yitzchak Scott-Thoennes
On Mon, Jan 16, 2006 at 06:21:54PM -0800, [EMAIL PROTECTED] wrote: > One might hope that a script like this: > > test3 > #!/usr/bin/perl > BEGIN { > no lib qw|/usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/ > lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/ > site_p

Re: DateTime performance

2006-01-18 Thread Yitzchak Scott-Thoennes
On Wed, Jan 18, 2006 at 08:38:13AM -0800, [EMAIL PROTECTED] wrote: > >Then no lib isn't doing what you want. > > Agree. But, that is the point. Outside of recompiling perl with new > paths or significantly altering DateTime to use far fewer > dependancies nothing can really be done. > > test4

Re: DateTime performance

2006-01-18 Thread matthew
Then no lib isn't doing what you want. Agree. But, that is the point. Outside of recompiling perl with new paths or significantly altering DateTime to use far fewer dependancies nothing can really be done. test4 #!/usr/bin/perl BEGIN { @INC = grep !/5\.8\.[0-5]/, @INC } use DateTime; [EMA

Re: DateTime performance

2006-01-18 Thread matthew
Do your traces show it still searching all the removed paths? yes There's no way the above should be doing that, unless you're loading DateTime earlier, via sitecustomize.pl or $PERL5OPT? Neither of the items you have identified are used in any way during these tests. I would expect if eit

Re: DateTime performance

2009-01-23 Thread Dave Rolsky
On Fri, 23 Jan 2009, arie.ha...@gmail.com wrote: Why DateTime module is loaded so slow? This simple script that just imports DateTime is executed for 1 second approximately: use DateTime; Can I make it faster? Yes, you need a faster computer! auta...@houseabsolute:~/projects/R2$ time perl

Re: DateTime performance

2009-02-14 Thread Zefram
arie.ha...@gmail.com wrote: >Our project requres getting time-zone offset for the given time-zone >id at the current time. You can speed things up a bit by using the timezone modules in isolation. You can construct a fake DateTime class, which only provides the methods ->utc_rd_as_seconds and ->ut

Re: DateTime performance

2012-05-03 Thread Michael G Schwern
On 2012.5.1 3:29 PM, Philipp K. Janert wrote: > However, when working through a files with a few > tens of millions of records, DateTime turns into a > REAL drag on performance. > > Is this expected behavior? And are there access > patterns that I can use to mitigate this effect? > (I tried to

RE: DateTime performance

2012-05-03 Thread Andrew O'Brien
> From: Philipp K. Janert [mailto:jan...@ieee.org] > Sent: Wednesday, 2 May 2012 8:29 AM > > Question: > > When using DateTime for a large number of > instances, it becomes a serious performance > drag. ... > Is this expected behavior? And are there access > patterns that I can use to mitigate th

Re: DateTime performance

2012-05-03 Thread Rick Measham
In the spirit of TIMTOWTDI, there's my DateTime::LazyInit module which I wrote for this sort of case. It only inflates to a full DateTime object when you call methods that aren't "simple". http://search.cpan.org/~rickm/DateTime-LazyInit-1.0200/lib/DateTime/LazyInit.pm Caveat: I haven't tested

Re: DateTime performance

2012-05-03 Thread Ashley Pond V
I love and use DateTime for for 10s of millions of records at once I would be choosing Date::Calc instead and dealing with any necessary futzy bits manually. On Thu, May 3, 2012 at 2:53 AM, Rick Measham wrote: > In the spirit of TIMTOWTDI, there's my DateTime::LazyInit module which I > wrote for

Re: DateTime performance

2012-05-04 Thread Philipp K. Janert
On Thursday 03 May 2012 02:10:04 you wrote: > On 2012.5.1 3:29 PM, Philipp K. Janert wrote: > > However, when working through a files with a few > > tens of millions of records, DateTime turns into a > > REAL drag on performance. > > > > Is this expected behavior? And are there access > > patterns

Re: DateTime performance

2012-05-04 Thread Philipp K. Janert
On Thursday 03 May 2012 02:14:45 you wrote: > > From: Philipp K. Janert [mailto:jan...@ieee.org] > > Sent: Wednesday, 2 May 2012 8:29 AM > > > > Question: > > > > When using DateTime for a large number of > > instances, it becomes a serious performance > > drag. > > ... > > > Is this expected b

Re: DateTime performance

2012-05-05 Thread N Heinrichs
++ to using precomposed TZ object (as you observed, supplying only the name as a string still results in lengthy DT:TZ object creation overhead.) If you use them, I would also precompose any necessary Formatter or Locale objects. Depending on how you're parsing the date strings and composing the

Re: DateTime performance

2012-05-06 Thread Philipp K. Janert
On Saturday 05 May 2012 17:14:52 N Heinrichs wrote: > ++ to using precomposed TZ object (as you observed, supplying only the > name as a string still results in lengthy DT:TZ object creation > overhead.) > > If you use them, I would also precompose any necessary Formatter or > Locale objects. >