Mail Archives: djgpp/2001/11/25/18:04:15
From: | Donovan Rebbechi <elflord AT panix DOT com>
|
Newsgroups: | comp.os.msdos.djgpp,comp.lang.c++
|
Subject: | Re: ostringstream vs. ostrstream performance
|
Followup-To: | comp.lang.c++
|
Date: | 25 Nov 2001 22:50:03 GMT
|
Organization: | PANIX Public Access Internet and UNIX, NYC
|
Lines: | 35
|
Message-ID: | <slrna02tcr.3q0.elflord@panix2.panix.com>
|
References: | <3C0100AC DOT 93129C4B AT bigfoot DOT com>
|
NNTP-Posting-Host: | panix2.panix.com
|
X-Trace: | news.panix.com 1006728603 20086 166.84.1.2 (25 Nov 2001 22:50:03 GMT)
|
X-Complaints-To: | abuse AT panix DOT com
|
NNTP-Posting-Date: | 25 Nov 2001 22:50:03 GMT
|
User-Agent: | slrn/0.9.7.2 (NetBSD)
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
In article <3C0100AC DOT 93129C4B AT bigfoot DOT com>, Alex Vinokur wrote:
>===============================================================
> Windows98
> gpp : GNU C++ version 2.95.3 20010315/djgpp (release) (djgpp)
> compiled by GNU C version 2.95.3 20010315/djgpp (release).
>===============================================================
>
>
> Hi,
>
> Here are some results of comparing performance : 'ostrstream vs.
> ostringstream'.
> It seems that the results are weird :
> ostringstream::operator<< is improbably slower than
> ostrstream::operator<<.
>
> Any explanation?
> Something wrong in this experiment?
First, it doesn't surprise me that much, because with strstream, because
there's less indirection.
However, your methods could do with some improvement.
For example, it's probably better to put the two in seperate programs,
and time them using the "time" command. This tells you about how
much CPU the program uses. The issue this addresses is that programs
may slow down over time, because the operating system deprioritises
them to prevent them eating all the CPU.
Another test that may be interesting is profiling your program, to get
some more precise insights as to why <sstream> is slower.
--
Donovan
- Raw text -