Thursday, 21 Jun 2007
Thursday, 21 Jun 2007
With integration of CWS dr54 a quite small but very effective change regarding updates of references to external documents when loading a spreadsheet will become available. In a customer's test case document this brought down loading time from over 15 minutes to 7 seconds, which is by factor 128 or more.
Some details: imagine a spreadsheet with cells listening to large ranges of external references such that there are 35000 formula fragments listening to an identical range (A) of 50000 cells, another 9000 formula fragments listening to an identical range (B) of 50000 cells, and yet another 9000 formula fragments listening to yet another identical range (C) of 50000 cells. After having loaded the document the user is asked whether to update data of the external references. If answering yes the external data is loaded and the relevant parts replace the already existing cached data.
The replacement has the consequence that for each changed cell content the change is broadcasted to the listening cells, and although a resulting action is taken only if the target cell wasn't already notified, the overhead of the broadcasting mechanism was responsible for the massive slowdown. To stick with the numbers from above for simplicity:
Broadcaster Actions
A: 50000 * 35000 = 1,750,000,000
B: 50000 * 9000 = 450,000,000
C: 50000 * 9000 = 450,000,000
-------------
2,650,000,000
So, even if for range A after the first cell change was broadcasted all listening formula fragments were dirty, quite significant portions of the algorithm were still ran through for the remaining 1,749,999,999 notifications. Same for ranges B and C. This is where I placed the scalpel to cut things off and introduced a caching mechanism that remembers ranges formulas are listening to when broadcasted during a certain action. This gives:
Broadcaster Actions
A: 1 * 35000 = 35,000Cache Lookups
B: 1 * 9000 = 9,000
C: 1 * 9000 = 9,000
-------------
53,000
A: 49999 * 1 = 49,999
B: 49999 * 1 = 49,999
C: 49999 * 1 = 49,999
-------------
149,997
Wow! Great!
Comments
Posted by Kami on June 22, 2007 at 07:09 AM CEST #
Posted by OOoForum on June 22, 2007 at 10:10 AM CEST #
Posted by Eike on June 25, 2007 at 12:57 PM CEST #
Posted by Nick on June 25, 2007 at 01:48 PM CEST #
Posted by Eike on June 26, 2007 at 10:24 AM CEST #
Posted by Jack Fuller on June 29, 2007 at 08:34 PM CEST #
Posted by Eike on June 29, 2007 at 09:00 PM CEST #
Posted by Joe on July 01, 2007 at 07:14 PM CEST #