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>
Fri, 6 Aug 2021 16:14:22 +0200

          From comp.compilers

Related articles
| List of all articles for this month |

From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Newsgroups: comp.compilers
Date: Fri, 6 Aug 2021 16:14:22 +0200
Organization: Aioe.org NNTP Server
References: 21-08-001 21-08-003
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
Content-Language: en-US

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


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.