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?
In reply to memory penalty for loading XS modules? by lestrrat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |