[Patch] Reimplement (and split) istream::ignore
Paolo Carlini
pcarlini@suse.de
Sun Jun 20 17:19:00 GMT 2004
Hi,
eventually I went ahead with the idea sketched some time ago. Similarly
to what other implementations are already doing, the mandated
ignore(streamsize __n = 1, int_type __delim = traits_type::eof())
can be profitably "split" into:
ignore()
ignore(streamsize __n)
ignore(streamsize __n, int_type __delim)
since this allows much simpler and better performing implementations of
the first two. Also, the last two can thus exploit the same mechanism
already used for istream::getline.
To give you some numbers, on x86-64-2GHz, "ignoring" 2400000 lines each
200 char long and '\n' terminated of a disk file takes:
current
-------
1.971u 0.347s 0:02.31 100.0% 0+0k 0+0io 0pf+0w
patched
-------
0.180u 0.381s 0:00.56 100.0% 0+0k 0+0io 0pf+0w
and this is the "worst" case, since the first two overloads are faster
than the general case.
Regtested x86/x86-64.
Paolo.
////////////////
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_ignore
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040620/ce696af6/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_ignore
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040620/ce696af6/attachment-0001.ksh>
More information about the Libstdc++
mailing list