From 125f39c745bab95ba5be7e4a3f030ef6ae3ce52e Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Sat, 16 Aug 2014 11:12:32 +0100 Subject: [PATCH] Minor performance tweak to PHPTemp and DiscISAM caching --- Classes/PHPExcel/CachedObjectStorage/DiscISAM.php | 10 +++++----- Classes/PHPExcel/CachedObjectStorage/PHPTemp.php | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Classes/PHPExcel/CachedObjectStorage/DiscISAM.php b/Classes/PHPExcel/CachedObjectStorage/DiscISAM.php index 96cb1e23..c46cdd95 100644 --- a/Classes/PHPExcel/CachedObjectStorage/DiscISAM.php +++ b/Classes/PHPExcel/CachedObjectStorage/DiscISAM.php @@ -69,11 +69,11 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage $this->_currentObject->detach(); fseek($this->_fileHandle,0,SEEK_END); - $offset = ftell($this->_fileHandle); - fwrite($this->_fileHandle, serialize($this->_currentObject)); - $this->_cellCache[$this->_currentObjectID] = array('ptr' => $offset, - 'sz' => ftell($this->_fileHandle) - $offset - ); + + $this->_cellCache[$this->_currentObjectID] = array( + 'ptr' => ftell($this->_fileHandle), + 'sz' => fwrite($this->_fileHandle, serialize($this->_currentObject)) + ); $this->_currentCellIsDirty = false; } $this->_currentObjectID = $this->_currentObject = null; diff --git a/Classes/PHPExcel/CachedObjectStorage/PHPTemp.php b/Classes/PHPExcel/CachedObjectStorage/PHPTemp.php index 1e36e104..e28429de 100644 --- a/Classes/PHPExcel/CachedObjectStorage/PHPTemp.php +++ b/Classes/PHPExcel/CachedObjectStorage/PHPTemp.php @@ -61,11 +61,11 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_ $this->_currentObject->detach(); fseek($this->_fileHandle,0,SEEK_END); - $offset = ftell($this->_fileHandle); - fwrite($this->_fileHandle, serialize($this->_currentObject)); - $this->_cellCache[$this->_currentObjectID] = array('ptr' => $offset, - 'sz' => ftell($this->_fileHandle) - $offset - ); + + $this->_cellCache[$this->_currentObjectID] = array( + 'ptr' => ftell($this->_fileHandle), + 'sz' => fwrite($this->_fileHandle, serialize($this->_currentObject)) + ); $this->_currentCellIsDirty = false; } $this->_currentObjectID = $this->_currentObject = null;