[rescue] [geeks] Mozilla and Java

Charles Shannon Hendrix shannon at widomaker.com
Mon May 3 00:04:28 CDT 2004


Moved to geeks...

Mon, 26 Apr 2004 @ 13:20 -0500, Jonathan C. Patschke said:

> > I doubt that.  Not all of Mozilla is written in the XUL stuff.
> 
> And not all of Java is slow.  Mozilla is DOG slow on most of the
> machines I run it on.

Mozilla wants memory, a lot of it.  

It also seems to be trying to break a world record for a program making
clib/OS/system calls.

Just now I ran an strace on the current Mozilla process for 5 seconds.
The program is idle, just sitting with 3 tabs to www.ebay.com, no JS
and no animations.

Idle.

In five seconds it made 3000 calls.

    select(47, [46], [], [], {0, 0})        = 0 (Timeout)
    gettimeofday({1083554304, 800086}, NULL) = 0
    gettimeofday({1083554304, 800230}, NULL) = 0
    gettimeofday({1083554304, 800374}, NULL) = 0
    gettimeofday({1083554304, 800544}, NULL) = 0
    gettimeofday({1083554304, 800698}, NULL) = 0
    gettimeofday({1083554304, 801544}, NULL) = 0
    gettimeofday({1083554304, 802415}, NULL) = 0
    gettimeofday({1083554304, 802588}, NULL) = 0
    ioctl(3, FIONREAD, [0])                 = 0
    ioctl(46, FIONREAD, [0])                = 0
    gettimeofday({1083554304, 803152}, NULL) = 0
    poll([{fd=3, events=POLLIN}, {fd=10, events=POLLIN}, {fd=14,
    events=POLLIN|POLLPRI}, {fd=16, events=POLLIN|POLLPRI}, {fd=17,
    events=POLLIN|POLLPRI}, {fd=18, events=POLLIN|POLLPRI}, {fd=20,
    events=POLLIN}, {fd=4, events=POLLIN}, {fd=46, events=POLLIN}], 9, 20) = 0
    gettimeofday({1083554304, 824084}, NULL) = 0
    ioctl(46, FIONREAD, [0])                = 0

...blah blah blah.

That's around 3 million calls per hour.

Maybe someone out there is working on a new one and just hasn't told
anyone...

> > What I can't figure out is why such serious problems exist with little
> > noise about them.
> 
> Do you read online web comics?  The recent thread of "User Friendly"
> is particularly disgusting.

Sometimes.  Have to check it out.

I used to have a program downloading UF, Dilbert, etc daily, but it
seems to have died N weeks ago.

> > > And, at least we know Java's GC works.
> >
> > Do we?
> 
> It works for me.

The java_vm process starts at 212MB.  It is sparse, but it seems to
affect VM negatively anyway.  

> The JVM will not leak more memory than you allocate to it.  It will also
> not typically GC until it gets close to that limit (for performance
> reasons).  Obviously, you can use a different GC strategy.

Know a good WWW site on jvm tuning?  I've tried a bit, but most of my
fiddling results in the application crashing on startup.

> I think you're being bitten by the atypical shit Java that Sun and IBM
> and Oracle put out in ther system-management software.  

Well, that's definitely part of it.  The Oracle 8 installer was
particularly bad.

The worst I saw was not a GUI.  It was data processing.  A shop where
I worked took our C and Perl code and rewrote it in Java after an "all
code will be Java" edict, and the performance was dismal.

The code was basically just IO engines doing split, merge, extract, and
data analysis on fixed-length records.  Read a file, do stuff, write 1-N
files as output.

I think it was stupid to rewrite in Java in the first place, but at the
same time I don't see why Java should be that much worse than Perl. 

I saw some of the programs, and they didn't appear that bad.  They were
a lot cleaner than the GUI/WWW Java I'd seen.  I can't say much about
how the IO classes were used because I don't know anything about them.

Most were code in the same basic form:

    open files
    loop while reading records
	do something to record
	write record out to one of the output files
    end loop
    close files

Some of the code did get quite complex, but most of them were just I/O
and string heavy processes.

A few had been rewritten in C because the calculations were getting too
slow in Perl.

I'll never understand why they wanted to rewrite working code.

> > I wish something like NeXT had taken off instead of most of what we have
> > now.
> 
> They did.  It's called "OS X", and its market share is growing.

I was speaking in past tense, as in back when NeXT was on the market.





-- 
shannon "AT" widomaker.com -- ["Secrecy is the beginning of tyranny." --
Unknown]



More information about the rescue mailing list