Killing two birds with a one-line configuration change

Richard Henderson rth@redhat.com
Fri Apr 12 02:05:00 GMT 2002


On Thu, Apr 11, 2002 at 10:47:04PM -0500, Loren James Rittle wrote:
> The PR explicitly says "piping in the log file".  This is important.

I admit I hadn't noticed that in the pr before.  I'd been
running the test case as an argument.

> When the test case is run in that manner without the sync_with_stdio(false)
> calls and without _GLIBCPP_AVOID_FSEEK defined, there are 2 seek
> system calls *per* *character* *read* at the C++ application level on
> Linux!

Indeed.  Barf!

> Just to humor me, can you trace/time both:
> a.out <log  # fseek avoidance path of my patch only helps this case
> a.out log

With patch:

  With sync_with_stdio(false)

	a.out <log	33.17user 0.05system 0:33.22elapsed 99%CPU
			0 seeks per read; 4 seeks per write.

	a.out log	13.70user 0.06system 0:13.74elapsed 100%CPU
			2 seeks per read; 4 seeks per write.

	Yes, there are fewer seeks, but it still takes longer as cin.

  No sync_with_stdio

	Seeks and times unchanged.

Without patch:

  [ Grumble.  I deleted the library.  I'd rather send this mail out
    now than wait for it to rebuild. ]

2.95.3:

  No sync_with_stdio

	a.out <log	8.10user 0.22system 0:08.30elapsed 100%CPU
	a.out log	same


> I concluded that it will take some rearchitecture to fix right.

Bummer.  I'd been going to say that I think this is serious 
enough to warrant holding up the release to fix.  But a big
re-write wouldn't cut it...

> I could agreed except you must make cursor movement calls to ensure
> that C IO calls interleaved will work correctly.

True, but it seems like you'd be able to remove one of the
lseek calls at minimum.


r~



More information about the Libstdc++ mailing list