delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/20/04:19:47

Date: Wed, 20 Jan 1999 11:16:33 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Dong-Yueh Liu <dyliu AT ms1 DOT hinet DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: Question about efficiency: vector vs. deque
In-Reply-To: <36a5846a.17595250@news.silkera.net>
Message-ID: <Pine.SUN.3.91.990120110143.10700A-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On Wed, 20 Jan 1999, Dong-Yueh Liu wrote:

> The program is compile with -O3 option to turns on optimizations.

In many cases, -O2 is better than -O3.

> I am amazed by the result since I expected that vector should be
> faster the deque, but the result is reverse. The following is that
> I use VC++ 6.0 to compile the same program:
> vector: 0.961 seconds
> deque: 4.446 seconds
> 
> Can anyone explain why the efficiency of vector is worse than
> deque using gcc2.81?

``Use the source, Luke!''  The sources of the implementation of vector 
used by DJGPP are free to browse and hack (get v2gnu/lgp2811s.zip).

I think some implementations of vector reallocate memory very often, 
which might explain the difference.  But that's a speculation.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019