perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruben I Safir <>
Subject Re: What's going on with Embperl???
Date Thu, 18 Sep 2003 04:07:42 GMT

On 2003.09.17 20:59 Donovan Allen wrote:
> Ruben Safir Secretary NYLXS wrote:
> >Yes - In my experience I had a JSP programmer test his code for a scheduling
> >function against my code in EMBPerl and modules.  After the first hit,
> >I was much faster than he was.  I've done similar things with PHP coders
> >and even coded the PHP myslef.
> >
> >After the first hit, and when EMBPERL has it's logging level lowered,
> >is was outstandingly fast, especially with large data grabs, and pages
> >which were repeated.  OTOH, my HTTPD processes grow large...and I'm thrilled
> >to death about that.  
> >
> Like leaking memory large or just larger?  Unfortunately, the latter, as 
> you well know, is going to happen to some degree with any library cache 
> technology.  

Just large.  I've never had a memory leak in any Perl.  I've had canversations
with the Perl Developers and it seems to be all but impossible.  The causes of most
emory "leaks" in Perl is with the code where you keep creating objects and never 
scope them out of the program.  Misunderstanding of scope is a huge program with
mod_perl, because the damn program never ends.

But the http processes grow, and then stop growing at a point.

> I also have come across many CPAN modules that leak memory, which is 
> really great in mod_perl or other daemon scripts.  

I am not aware of any way for Perl to leak memory.  But if you show me the modules,
id be happy to pass them to Mike.

Memory leakage is when a pointer to an allocated memory location is removed from
scope prior to manual deallocation of the memory.  Or it can be when memory is
allocated and data is stored past the allocation.  In GNU/Linux, this would cause 
a segmentaiton fault by the program.  Of corse, people have smashed stacks, but
these exploits almost always involve standard self allocating C routines such as
scanf, etc.

Now Perl has no pointers.  It has a garbage collection system.  When programmer do not
use scope correctly, you can get a condition (and this happens all too frequently), when
an increasing number of data objects are created in global name space, either through
passed references which are attached to global variables, or other stupidities of this

USE STRICT in your modules (but don't use them in embperl though).  

Make sure everything is scoped to a namespace, function or block.

> No, I mean using faster ways with standard perl that use less "magic" 
> and are closer to just a c library call.  Most perl programs and 
> programmers are frought with using the easier to use functions and then 
> abandon the language for a project where performance was bad.  In most 
> cases like this where I took a look at what they were doing, I was able 
> to get the performance much much closer to C equivalent speeds.

While I've seen many discussions on optimized hashing and psuearrays etc,
I would argue that in most cases, if the objects are constructed adequately,
they will still out pace other platforms in modperl as the objects are created 
only once.  Then there is only the issue of doing the hashing.  It's a mnor hit
comaped to the standard PHP data object and the Java Engine.

If you understand what your doing and why, it is probibly that only direct C modules
will outpace Perl Code in Embperl, or just in mod_perl, and yet you will still have
highly maintainable code which is easy to bugtrack and extend.

> One simple example is IO, especially the I bit. :-)  Try reading a 80GB 
> file with pattern matches every line and substitution using <FILE> or 
> even IO->readline().  By using sysread() and using patterns matches to 
> divided lines into $1 etc, you get somewhere around 11x the speed.

Depending on the problem, I would probibly not attack this in this way in the first place.
80 megabytes of data need to be stored, IMO, in a database...not a flat file.

> >>So...want to volunteer for building a benchmark suite? :-)
> >>
> >>    
> >>
> >Sure - I have a spare machine.  We can make it an NYLXS project.
> >  
> >
> Excellent!  That will save me the effort of having to do benchmarks of 
> my own to decide if I stick with Embperl (which happens nearly everytime 
> I check to find little has happened in the last 3-4 months).

Join us on NYLXS at .  The mane mail list is hangout.  But be warned that
we are not a technology group, but an educational non-profit.  That means our emphaisis is
education, not the hot tech topic of the day :)

With that being said, if I may plug something here.

NYXS has the Free Software Institute.  We offer classes to the public in New York City
at very affordable rates (it is subsidized by our organization).  We are offering 2 classes
in the last week of Spetember.  One is "Introduction to Programming with Perl".  It is a 
class on Programming with Perl as the main example language.  It covers everything from 
the meaning of a symbolic variable to object oriented design in 6 weeks.  It is a terrific
taught by me.

The other class is UNIX 1 which is the command line power tools class.  It is being taught
NYU Hosptial Systems specialist, Joe Grastara.

Both Classes together cost $500.  They are unique.  Our students really learn.

If your interested, or no someone who is, see and you can register.

The whole program is 6 classes which includes Perl II - Which include embperl/Apache/mod_perl
amoung other
advanced topics.


Brooklyn Linux Solutions
DRM is THEFT - We are the STAKEHOLDERS - Consulting <-- Happy Clients - Leadership Development in Free Software - Unpublished Archive or stories and articles from around
the net - See the New Downtown Brooklyn....


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message