Comment 24 for bug 111299

Revision history for this message
In , Jim Kronebusch (jim-winonacotter) wrote :

I was just thinking (which isn't always a good thing). Would it be possible to modify this portion of the patch:

+static int
+get_discard_timer_ms (void)
+{
+ /* FIXME: don't hardcode this */
+ return 5000; /* 5 seconds */
+}

and add some intelligence to it? Could this involve some sort of formula that looked at what percentage of RAM is available and set the time accordingly? Say I have a system with 128MB RAM total, and 15% of it is in use, then the formula would set the discard time to 20 seconds. Then on the next request it would look at the percentage used again and see that 50% was in use, now it sets the discard time to 5 seconds. Next request RAM is almost full at 80%, discard set to .1 seconds. Does that make any sense? This would still involve some hard coded thresholds but it would add a little intelligence to the discard time. This could help increase performance when RAM is available, but stay safe when it is used up.

But this would also require a check on every request for pixmap storage which may add overhead. Also I don't know if the discard timer is set on every request or if it is only set on startup of Firefox. And I don't know if the discard time is set per individual storage request or if it affects all items currently in storage.

So feel free to tell me I'm nuts. It was just a thought :-)

Jim