Re: Apache::Registry - String Compaction == Less RAM?
Perrin Harkins wrote: On Mon, 2003-07-07 at 11:50, Nigel Hamilton wrote: I thought I could save some RAM by stripping out comments and whitespace before the eval step - so I quickly wrote a Registry-like handler that strips comments. Those don't take up any space in the actual compiled opcodes. The only space you could save is in the string that the file is initially loaded into and the $eval string that gets built up to pass to eval(). [...] I'd just like to add an example which shows you what exactly perl sees when it compiles your code: perl -MO=Deparse -le '\ print \ this is a string \ # hmm, some comment \ . another string \ # bummer, i should end the line now \ ;' prints: BEGIN { $/ = \n; $\ = \n; } print 'this is a stringanother string'; -e syntax OK Also see: __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Apache::Registry - String Compaction == Less RAM?
[sent it out too early] Stas Bekman wrote: Also see: http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlResponseHandler __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Apache::Registry - String Compaction == Less RAM?
On Mon, 2003-07-07 at 11:50, Nigel Hamilton wrote: I thought I could save some RAM by stripping out comments and whitespace before the eval step - so I quickly wrote a Registry-like handler that strips comments. Those don't take up any space in the actual compiled opcodes. The only space you could save is in the string that the file is initially loaded into and the $eval string that gets built up to pass to eval(). It's probably not worth pursuing, since the savings would be small and there is a risk of breaking code (parsing perl is hard). If you want to see how much it could possibly save, try just stripping a single file before feeding it to Registry and see how much of a difference that makes. I suspect that mod_perl is stripping them for me. Nope, it doesn't do anything like that. But isn't a large string allocated in RAM prior to the eval? Yes, the $eval string is as large as the full contents of the file. - Perrin