Enabling caching - is this OK?

Topics: Developer Forum
Dec 20, 2009 at 5:19 AM

From the many many minutes and GBs of memory required to process some complex (and deeply nested) formulas and after reviewing the debug dump it looked like calculation results weren't being cached so I decided to try to add caching.   As I looked into the code, I noticed that the calculated results caching seemed to be in place already... but wasn't being used.  I added the following to the front of the Cell.php getCalculatedValue() method (starting around line 269) and my processing dropped from 14 seconds to milliseconds.

            if (!is_null($this->_calculatedValue)) {

                return $this->_calculatedValue;

            }

The correct values seem to be coming back now, but since it was so simple of a change I wanted to make sure I wasn't shooting myself in the foot somewhere else.

Thoughts?

 

            if (!is_null($this->_calculatedValue)) {
                return $this->_calculatedValue;
            }

 

 

Dec 21, 2009 at 7:16 AM

disregard, calculations were not actually occurring, existing data was being returned .....back to looking for optimizations.

Developer
Jan 20, 2010 at 11:24 AM
joelrsimpson wrote:

disregard, calculations were not actually occurring, existing data was being returned .....back to looking for optimizations.

Ok, it was probably just returning the stored calculated value by the last application that saved the workbook.