[Patch] Speedup somewhat do_get_time and do_get_date

Paolo Carlini pcarlini@suse.de
Sat Jun 12 19:34:00 GMT 2004


Hi,

this is a straightforward improvement: the result can be definitely
obtained by calling _M_extract_via_format only /once/, with the correct
format string corresponding to 'x'/'X' (as mandated by 22.2.5.1.2),
and avoiding completely the widen-ing.

Some numbers on P4-2400 for this small benchmark (-O2):

  for (int i = 0; i < 3000000; ++i)
    {
      iss.str("04/04/71 ");
      iterator_type is_it02(iss);
      errorstate = good;
      tim_get.get_date(is_it02, end, iss, errorstate, &time02);
    }

(no codesize changes)

3.3.3
-----
12.740u 0.010s 0:12.77 99.8%    0+0k 0+0io 207pf+0w

3.4
---
3.420u 0.000s 0:03.42 100.0%    0+0k 0+0io 196pf+0w

patched 3.4
-----------
2.890u 0.000s 0:02.89 100.0%    0+0k 0+0io 195pf+0w

mainline
--------
4.700u 0.000s 0:04.71 99.7%     0+0k 0+0io 199pf+0w

patched mainline
----------------
3.820u 0.000s 0:03.82 100.0%    0+0k 0+0io 199pf+0w

Icc8.0
------
2.830u 0.000s 0:02.84 99.6%     0+0k 0+0io 196pf+0w

And on x86-64-2GHz:

mainline
--------
2.346u 0.000s 0:02.34 100.0%    0+0k 0+0io 0pf+0w

mainline patched
----------------
2.250u 0.000s 0:02.25 100.0%    0+0k 0+0io 0pf+0w


Regtested x86-linux.

Paolo.

P.S. Perhaps eventually case 'x' and case 'X' could be removed from
the switch in _M_extract_via_format...

/////////////////
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_get_time_date
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040612/c11a5bbd/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_get_time_date
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040612/c11a5bbd/attachment-0001.ksh>


More information about the Libstdc++ mailing list