Hi, On Sat, May 24, 2008 at 04:39:42PM -0400, Jorge Arellano Cid wrote:
On Sat, May 24, 2008 at 02:58:08PM +0200, Johannes Hofmann wrote:
Hi,
attached is patch to reduce the memory usage of dw2:
Excellent! (AFAIU this is near 30% memory usage reduction in dw2)
Committed.
* Styles are now reused if they are equal. This brings down the number of Style objects on the mysql page from around 180000 to 23000 and reduces memory usage by about 25M at the cost of an additional HashTable. Maybe the hash table should be part of fltkplatform as the hash tables for Color and Font? There would be even more sharing of styles possible, if x_link would not be part of style. On the other hand about 3M for styles on the huge mysql page is pretty ok.
* Size of struct Word is reduced by 4 integers by using shorts. I know that this is questionable, but I think in the case of struct Word that can be allocated a lot it is worth the hassle. Please check whether my assumption that space lengths and word lengths can be stored in shorts are valid in general.
It looks OK at first sight, but to be sure it'd be good to know what happens when the limit is surpassed.
Just tried it on a page with 40000 char long word. With short for hlStart/hlEnd, selection is - obviously - no longer possible. That's clearly a regression. Please revert with attached patch.
BTW, "unsigned short" looks like a good idea for origSpace and effSpace.
Adjusted in patch. Cheers, Johannes