[PATCH] add osl_atomic_* api to allow for inlined atomic increment/d...
Norbert Thiebaud (via Code Review)
gerrit at gerrit.libreoffice.org
Sun Sep 16 01:39:53 PDT 2012
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/631
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/31/631/1
add osl_atomic_* api to allow for inlined atomic increment/decrement
atomic increment/decrement is provided by
osl_increment/decrementInterlockedCount()
but that is a exported dll function, so it cannot be inlined.
valgrind analysis of a run, loading a medium sized spreadsheet, shows
that these 2 functions were called 3.5 millions times for a total cost of
55 millions of instructions... a cost of 8 instructions per call,
which is at least a 300% overhead since an atomic inc/dec is 2 instructions
iow we could save about 1% of the total instruction count of that run(4.6B)
We cannot change the existing api, as this would break ABI.
but we can add a new api. and migrate internal user to it.
osl_atomic_decrement/osl_atomic_increment do the same task,
than osl_*IntelockedCount() but do that inlined if possible.
Note that this version only optimize the case GCC with atomic built-in.
but support for other case should not be very hard.
follows-up patches will replace the use of the osl_*InterlockedCount()
in the product with their osl_atomic_* equivalent.
Change-Id: If4dcbf94ea6f62eb6d55d30613fe65878ffb8023
---
M sal/inc/osl/interlck.h
1 file changed, 14 insertions(+), 0 deletions(-)
--
To view, visit https://gerrit.libreoffice.org/631
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If4dcbf94ea6f62eb6d55d30613fe65878ffb8023
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Norbert Thiebaud <nthiebaud at gmail.com>
More information about the LibreOffice
mailing list