------- Comment #24 from tstarling at wikimedia dot org 2010-09-10 15:25
Created an attachment (id=21766)
The attached patch uses a dynamic_cast<> hack to avoid the need to break the
ABI. I added *_unlocked functions to cstdio, I'm not sure if this is necessary,
but it's easy enough to remove that part if not. I also added some
lightly-tested autoconf stuff. I'm an autoconf newbie so that part should
probably be reviewed carefully.
stdio_sync_filebuf<wchar_t>::_M_getline() is currently unreachable, since I
only edited basic_istream<char>::getline() and not
basic_istream<wchar_t>::getline(). It would be easy enough to fix that. I
haven't used getwc_unlocked() because it's a GNU extension, POSIX only has
non-wide unlocked I/O.
The timings for 1M lines with 500 bytes per line, user time only, are:
Old library: 26.7s
New library: 1.65s
So it's better, but not perfect.