Sin & Cos

This forum is currently in read-only mode.
From the Asset Store
Latency independent responsive controls. Beginner friendly documented.
  • Hi,

    Today I was wondering if Sin & Cos are calculated in real time, or there is a pre-calculated array\table with all Sin\Cos results.

    If not, and if you can do it, there will be the maximum performance when computing Sin & Cos.

  • It's calculated in real time for maximum precision, because you usually lose some accuracy with lookup tables.

  • Yeah, sin and cos usually are calculated for floats. I'd love to see a lookup table that contains all floats between 0 and 360

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yeah, it'll be faster for those who don't care of too much precision.

  • If you want precalculated you could do a lookup within Construct, with an array

  • If you want precalculated you could do a lookup within Construct, with an array

    That'd be much slower due to the overhead of running events. A sin or cos call can usually complete in under 200 cycles, which is about the overhead of running an event that calls an action that does nothing (let alone computing sin or cos).

    Yeah, it'll be faster for those who don't care of too much precision.

    Actually I doubt there will be any performance gains at all. Since performance improvements in 0.99, sin and cos don't appear as significant CPU users in profiles of the runtime, therefore there is little (read: none) gain to be had from further optimisation here.

    Did anyone notice performance improvements in 0.99? They substantially improved the runtime performance, and I don't think anyone mentioned they saw a difference just yet, so I'm not sure anyone would actually notice even if I replaced sin and cos with approximations

  • Uh forgot the event processing overhead (and should I assume there's some expression parsing overhead too?).

    I'm still too used to C++

  • Yes, obviously expressions don't compute themselves magically out of thin air with no cost, but I think compared to running conditions the cost is small.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)