Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #2692
| Path | csiph.com!xmission!usenet.csail.mit.edu!news.iecc.com!.POSTED.news.iecc.com!nerds-end |
|---|---|
| From | "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> |
| Newsgroups | comp.compilers |
| Subject | Re: Not normal for the same program to be faster in C# than in C++ [Visual Studio 2019] |
| Date | Fri, 6 Aug 2021 16:14:22 +0200 |
| Organization | Aioe.org NNTP Server |
| Lines | 38 |
| Sender | news@iecc.com |
| Approved | comp.compilers@iecc.com |
| Message-ID | <21-08-005@comp.compilers> (permalink) |
| References | <21-08-001@comp.compilers> <21-08-003@comp.compilers> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| Injection-Info | gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="72327"; mail-complaints-to="abuse@iecc.com" |
| Keywords | performance |
| Posted-Date | 08 Aug 2021 11:14:14 EDT |
| X-submission-address | compilers@iecc.com |
| X-moderator-address | compilers-request@iecc.com |
| X-FAQ-and-archives | http://compilers.iecc.com |
| Content-Language | en-US |
| Xref | csiph.com comp.compilers:2692 |
Show key headers only | View raw
On 2021-08-06 04:58, George Neuner wrote:
> I would modify your programs like so (in pseudo):
>
> total = 0
> allocate array
> for N iterations
> initialize array
> start = current time
> run the seive
> stop = current time
> total += (stop - start)
> average = total / N
Another technique is factoring out looping and other overheads by
running empty loop as a reference:
start = current time
for N iterations
initialize array
run the sieve
end loop;
total1 = start - current time
start = current time
for N iterations
initialize array
end loop;
total2 = start - current time
average = (total1 - total2) / N -- sieve only
P.S. Optimizations is a usual suspect of ruining benchmark measures.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar
Not normal for the same program to be faster in C# than in C++ [Visual Studio 2019] Paolo Ferraresi <fp.box@alice.it> - 2021-08-05 18:24 +0000
Re: Not normal for the same program to be faster in C# than in C++ [Visual Studio 2019] George Neuner <gneuner2@comcast.net> - 2021-08-05 22:58 -0400
Re: Not normal for the same program to be faster in C# than in C++ [Visual Studio 2019] "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2021-08-06 16:14 +0200
Re: Not normal for the same program to be faster in C# than in C++ [Visual Studio 2019] gah4 <gah4@u.washington.edu> - 2021-08-08 12:38 -0700
csiph-web