[Patch] Cache moneypunct

Paolo Carlini pcarlini@suse.de
Thu Feb 19 22:25:00 GMT 2004


Hi,

this is the bulk of the work, still missing do_get, but the entire
infrastructure is ready and do_put is functional.

I haven't encountered major difficulties and there are very few
differences wrt the numeric case: probably the most notable is
that we have an additional parameterization on _Intl, consistent
with moneypunct itself.

I have tested the patch on x86-linux, both gnu/generic locale
models and done some basic checks with valgrind on small
testcases from the testsuite.

In order to verify that the cache was actually working I have
benchmarked this (P4-2400, -O2):

  locale loc_hk = locale("en_HK");
  ...
  const string digits2("-10000000000000");
  ...
  for (int i = 0; i < 3000000; ++i)
    {
      oss.str(empty);
      mon_put.put(oss.rdbuf(), true, oss, ' ', digits2);
    }

current mainline
----------------
12.370u 0.010s 0:12.75 97.0%    0+0k 0+0io 250pf+0w

current + cache
---------------
8.480u 0.000s 0:08.73 97.1%     0+0k 0+0io 251pf+0w

Not a big deal, but the cache seems functional. While I was at it
I have noticed that a "strategic" string::reserve could reduce
the number of reallocations, so now (*):

current + cache + reserve
-------------------------
6.350u 0.000s 0:06.52 97.3%     0+0k 0+0io 253pf+0w

I mean to test the patch some more and then, in 1 day or 2 commit it,
modulo your comments, of course. In the meanwhile, finish money_get.

Paolo.

(*) More work in this area forthcoming!

//////////////////////
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_mon_cache
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040219/65b1ab22/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_mon_cache
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040219/65b1ab22/attachment-0001.ksh>


More information about the Libstdc++ mailing list