RESOLVED FIXED 5677
speed up KWQ timers by using CFRunLoopTimer instead of NSTimer
https://bugs.webkit.org/show_bug.cgi?id=5677
Summary speed up KWQ timers by using CFRunLoopTimer instead of NSTimer
Darin Adler
Reported 2005-11-09 07:50:45 PST
I saw some NSTimer and Objective-C overhead when profiling benchmarks that can be eliminated. I'm working on a patch that speeds things up and also simplifies how the back/forward cache suspends and resumes timers. I landed this once, but it caused regressions so we have to work on this more and test a bit more.
Attachments
version that seems to work well (62.12 KB, patch)
2005-11-09 08:09 PST, Darin Adler
no flags
Darin Adler
Comment 1 2005-11-09 08:09:34 PST
Created attachment 4640 [details] version that seems to work well I'm not sure exactly what to do about this. I can't reproduce any problems with this version of the patch, but Tim said he had big problems with Dashboard. I can't seem to test this with Dashboard successfully. Someone else may have to test and land this. I think the speedup and simplification is worth it, and there might even be some bug fixes in the cleaned up back/forward code.
Darin Adler
Comment 2 2005-11-09 08:14:06 PST
Comment on attachment 4640 [details] version that seems to work well Tim already reviewed this once -- I think it's time to review, test, and land this version.
Eric Seidel (no email)
Comment 3 2005-12-03 14:00:13 PST
Comment on attachment 4640 [details] version that seems to work well Shouldn't PausedTimeouts create and destroy the actual array? Or maybe it should take them, but construction should be the last step in the fuction. Would be more obvious if we had PassRefPtr, but we don't yet. Also, I'm curious as to why you might wish to use a raw c array and length pointer (for the paused timeouts array), instead of something like a QMemArray which would hold the two together for you? Wow. That was a big patch. And I don't feel like my brain managed to soak in every line of code change, but in general it looke sane, besides the manual memory management noted above.
Darin Adler
Comment 4 2005-12-03 16:38:15 PST
(In reply to comment #3) > (From update of attachment 4640 [details] [edit]) > Shouldn't PausedTimeouts create and destroy the actual array? Or maybe it > should take them, but construction should be the last step in the fuction. > Would be more obvious if we had PassRefPtr, but we don't yet. The PausedTimeouts class's destructor does destroy the actual array, but the constructor doesn't create it -- instead it adopts it. That's for efficiency but maybe there's a better way to do it. I'm not sure I understand your question. PassRefPtr wouldn't help much since the array is not a reference-counted object. > Also, I'm curious as to why you might wish to use a raw c array and length > pointer (for the paused timeouts array), instead of something like a QMemArray > which would hold the two together for you? A QMemArray would be OK, but it has extra overhead to accomodate resizing the array. This is a fixed-size array and we don't have a class that implements that.
Eric Seidel (no email)
Comment 5 2005-12-06 23:31:00 PST
(In reply to comment #4) > (In reply to comment #3) > The PausedTimeouts class's destructor does destroy the actual array, but the constructor doesn't create it -- instead it > adopts it. That's for efficiency but maybe there's a better way to do it. > > I'm not sure I understand your question. PassRefPtr wouldn't help much since the array is not a reference-counted object. A momentary lapse of judgement. :) > > Also, I'm curious as to why you might wish to use a raw c array and length > > pointer (for the paused timeouts array), instead of something like a QMemArray > > which would hold the two together for you? > > A QMemArray would be OK, but it has extra overhead to accomodate resizing the array. This is a fixed-size array and we > don't have a class that implements that. Yes, that's a shame. The encapsulation may still be worth the overhead.
Darin Adler
Comment 6 2005-12-10 09:06:59 PST
Comment on attachment 4640 [details] version that seems to work well This patch was missing at least one required nil check.
Note You need to log in before you can comment on or make changes to this bug.