[fortran-dev, patch] Parsed format data caching
Jerry DeLisle
jvdelisle@verizon.net
Sun Mar 29 02:24:00 GMT 2009
Hi folks,
This patch uses the simplest of hashing functions to hash a format string and
save a pointer to the parsed format data and its tokenized fnode tree.
This saves repeated re-parsing of format strings for every instance of a
formatted I/O operation, especially inside loops.
The method is probabilistic, meaning it relies on a good chance you won't
clobber previously saved data. If there is a collision, the previously saved
data is discarded and replaced by the new. The hash table size is fixed with 16
entries.
On some test cases I have seen about 18% speed up in formatted I/O.
Regression tested on x86-64-linux-gnu.
OK for commit to fortran-dev branch? If anyone is curious, the patch will apply
on 4.4 and 4.5 with some fuzz.
Regards,
Jerry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: format-cache.diff
Type: text/x-patch
Size: 11342 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20090329/09969634/attachment.bin>
More information about the Gcc-patches
mailing list