[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: Re: Memory Usage
From: Lars Knoll <Lars.Knoll () mpi-hd ! mpg ! de>
Date: 2000-05-02 17:24:08
[Download RAW message or body]
On Wed, 26 Apr 2000, Andreas Pour wrote:
>
> Hi,
>
> When viewing a not-so-realistic file -- like this:
>
> <HTML>
> <BODY>
> 11<BR>
> . . . (repeat 11<BR> about 55,000 times)
> 11<BR>
> </BODY>
> </HTML>
You took about the worst example one could find for khtml aswell
concerning speed as memory usage :-)
First of all, khtml is at the moment quite slow when it comes to
formatting extremely long paragraphs (and <br> elements don't make a
paragraph break). Tis is because paragraph layouting does go with O(n^2)
at the moment for some stupid reasons. If you add a <p> every 1000 lines,
it should be much faster. This is a known problem, and has to be fixed.
Concerning memory usage: Every text part and every <br> element will force
the creation of an object in the DOM tree, one in the rendering tree and a
style object. So you create 3 objects with some data for every 3 bytes of
input. This will result in a poor memory performance. Fortunately, no real
world html page looks like this and memory usage for realistic web pages
are much better. But I agree with you that we still have to optimize
quite some things.
> Plugging together my 3 data points, I get the rough formula:
>
> 10.6MB + 70 * filesize
>
> which seems a lot for a file with such a simple layout.
The problem is as mentioned above that it's _too_ simple. A realistic file
of the same size (with for example 40 chars before every <br>) would
already reduce memory consumption quite a lot.
> Just out of curiosity, I removed all the <BR>'s and put the 55,000 lines
> of '11' between <PRE> tags, and the result was:
>
> time konqueror /tmp/testp.html
> 7.86user 0.44system 0:14.31elapsed 57%CPU (0avgtext+0avgdata
> 0maxresident)k
>
> and memory usage was:
>
> PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND
> 1978 pts/8 S 0:07 2373 2 19617 14568 11.3 konqueror
> /tmp/testp.html
>
> So about 16 seconds faster and about 1/7th the memory consumption . . .
That should be even less. I'll have a look at it.
> Third, the file is displayed strangely. The first roughly 10% of the
> lines have what appear to be two blobs in each line, which should be
> 1's. The rest of the lines are empty -- it appears as if lines are
> being drawn on top of each other, but offset horizontally a bit. (The
> small and medium files display correctly but the display with the <PR>
> tags was even stranger -- 3 blobs per line for about the first 7% and
> the rest of the lines empty).
Hmmm.... some rendering problem. Antti?
Ciao,
Lars
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic