Giter VIP home page Giter VIP logo

Comments (2)

Woyten avatar Woyten commented on June 6, 2024

Benchmark results

Parameters

  • Commit: f3a8747
  • CPU: Intel Core i7-6700HQ CPU @ 2.60GHz
  • OS: Ubuntu 20.04.1 LTS
  • Metric: Max. number of concurrent waveforms without audio buffer underrun (--out-buf 2048)

Organ 1

  • f64: 200 (= 800 Sin stages)
  • f32: 300 (= 1200 Sin stages)

Plucked String

  • f64: 510
  • f32: 480

Fat Sawtooth 1

  • f64: 800 (= 1600 Sawtooth stages)
  • f32: 790 (= 1580 Sawtooth stagess)

Triangle Harp

  • f64: 900
  • f32: 880

Conclusion

  • When using regular arithmetic on a 64-bit CPU f64 offers a slightly better performance than f32. This result is not completely unexpected since 64-bit CPUs are designed to consume f64s in a single instruction. The fact that an f64 consumes twice as much memory as an f32 does not seem to play a significant role.
  • However, for more complex arithmetic involving convergence like {float}::sin, f32 clearly is faster than f64. The obvious explanation is that since f64 has a higher precision than f32 more iteration steps are required until a value is fully converged.

Follow-Up

  • For the sake of consistency and since a numeric precision loss is undesired, use f64 everywhere.
  • The cost for transforming an f64 buffer from and to an f32 audio buffer is expected to be negligible.
  • Check if there are other ways of improving f64::sin without sacrificing numeric precision.

from tune.

Woyten avatar Woyten commented on June 6, 2024

Consistent usage of f64 implemented in 206b416

New benchmark results:

  • Organ 1: 200
  • Plucked String: 680
  • Fat Sawtooth 1: 810
  • Triangle Harp: 860

from tune.

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.