Code Monkey home page Code Monkey logo

Comments (3)

wjakob avatar wjakob commented on June 6, 2024

Hi @yangfengzzz,

it sounds highly unlikely. Can you post the full compilation options including a full example that computes the timings? Note that measuring the time of simple functions can be challenging to do unless you set things up very carefully because the compiler notices irrelevant computation that is subsequently optimized away.

Wenzel

from enoki.

yangfengzzz avatar yangfengzzz commented on June 6, 2024

@wjakob

ζˆͺ屏2020-03-31 δΈ‹εˆ5 01 41

double durationInSeconds() const { auto end = std::chrono::steady_clock::now(); long long count = std::chrono::duration_cast<std::chrono::microseconds>( end - _startingPoint).count(); return count / 1000000.0; } //! Resets the timer. void reset() { _startingPoint = _clock.now(); }

This is my simple code, I think there must be wrong somewhere, but the time is 0.903766 vs 0.008044 in debug mode(without any compile flag)

I use Xcode as IDE and new MacOS System so I think the compiler is not old version. Thank you very much!

from enoki.

wjakob avatar wjakob commented on June 6, 2024

There are elementary mistakes here, I suggest that you read up on microbenchmarks in C/C++. For example, you are not using the result of the computation, so parts of it are likely optimized away by the compiler. Another issue is that Enoki mainly pays off when you are working with packets, so Array<Array<float>, 3> and not Array<float, 3>.

from enoki.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.