delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/04/07:46:21

From: James Undery <james AT ghoti DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: [Q]Computing speed in C++
Date: Wed, 4 Mar 1998 12:36:56 +0000
Organization: None unless you want to pay me
Message-ID: <NhY3fDAorU$0Ewz4@ghoti.demon.co.uk>
References: <34FCB769 DOT 42BEF1A8 AT gong DOT snu DOT ac DOT kr>
<34FD3174 DOT 2401F904 AT gong DOT snu DOT ac DOT kr>
Reply-To: ghoti AT nospam DOT demon DOT co DOT uk
NNTP-Posting-Host: ghoti.demon.co.uk
MIME-Version: 1.0
Lines: 15
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <34FD3174 DOT 2401F904 AT gong DOT snu DOT ac DOT kr>, Bum-Seok Hyun
<dominic AT gong DOT snu DOT ac DOT kr> writes
>In C code, I just moved variable definitions
>into the first line of the code.

Why, a fairer comparison of C and C++ is to compile the C as C++

>I don't think that makes musch difference between C++ and C.

Yes it does, or certainly would do with objects. 'j' would be
constructed (and destructed) 10000 times and 'k' 100000 times.
That said the C++ is still slower 22s (25s using your code) compared to
16s (on my system).
-- 
James Undery <james AT ghoti DOT demon DOT co DOT uk>  

- Raw text -


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