lestrrat has asked for the wisdom of the Perl Monks concerning the following question:
I'm currently trying to port DateTime::TimeZone to XS so that it consumes less memory. But I'm currently being baffled by the seeming *increase* in the memory being used by loading the XS version of the module.
DateTime::TimeZone is comprised of a a base class, DateTime::TimeZone, and a few hundred subclasses which represent each time zone. For example, Asia/Tokyo timezone is represented as DateTime::TimeZone::Asia::Tokyo. Each of these timezones contains a list of data, which I've now converted to C structs.
Now, loading one time zone and comparing its size with what Devel::Size reports, the savings are clear. Here's an example:
Europe/Belfast: 51735 (Pure Perl) Europe/Belfast: 2525 (XS)
However, this isn't translating into actual memory savings. This is the output from my top (Mac OS X)
PID COMMAND %CPU TIME #TH #PRTS #MREGS RPRVT RSHRD RSI +ZE VSIZE (XS) 26873 perl 0.0% 0:03.43 1 12 1177 14.6M 12.0M 2 +1.9M 51.0M (PP) 26872 perl 0.0% 0:02.83 1 12 46 13.4M 1.42M 1 +4.6M 33.3M
What gives? The XS version seems to consume more than 18 MB more than the pure perl version?! I think I've applied all the XS hackery I know to reduce memory consumption, is there any tips to reduce this memory size? or am I looking at the wrong numbers?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: memory penalty for loading XS modules?
by salva (Canon) on Jul 11, 2005 at 16:37 UTC | |
by lestrrat (Deacon) on Jul 12, 2005 at 13:09 UTC | |
|
Re: memory penalty for loading XS modules?
by hatter (Pilgrim) on Jul 11, 2005 at 16:41 UTC | |
by salva (Canon) on Jul 12, 2005 at 09:02 UTC | |
|
Release Early, Release Often.
by mugwumpjism (Hermit) on Jul 12, 2005 at 06:08 UTC | |
by Anonymous Monk on Jul 12, 2005 at 06:43 UTC | |
by mugwumpjism (Hermit) on Jul 14, 2005 at 04:18 UTC | |
|
Re: memory penalty for loading XS modules?
by sth (Priest) on Jul 12, 2005 at 18:55 UTC |