Path: csiph.com!weretis.net!feeder8.news.weretis.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c++ Subject: Re: What does "current time" mean? Date: Tue, 07 Feb 2023 11:51:01 -0800 Organization: None to speak of Lines: 24 Message-ID: <87a61pdzkq.fsf@nosuchdomain.example.com> References: MIME-Version: 1.0 Content-Type: text/plain Injection-Info: reader01.eternal-september.org; posting-host="4db3b9aae9ba641a7bd7c831368aa4f5"; logging-data="4053810"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+EuvJIGMH4SU+En46cJ+sK" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:JlU2xB6dYZmWxzhycgCkY6YE+/Y= sha1:Y2tUaHbzWMFA1qwW/qYRUAGxiEQ= Xref: csiph.com comp.lang.c++:89021 Manu Raju writes: > Some of you might be interested in this paper by Amazon Engineer: > > From the paper: auto start = chrono::high_resolution_clock::now(); auto result = fib(which); auto end = chrono::high_resolution_clock::now(); ... I was surprised to discover that the program printed an elapsed time of zero milliseconds on at least one compiler. Looking at the generated code at https://godbolt.org/z/vY5d9bref revealed that the compiler had reordered the code to get the end time prior to running the calculation. I'm surprised such a transformation would be legal. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for XCOM Labs void Void(void) { Void(); } /* The recursive call of the void */