Ignore:
Timestamp:
Oct 12, 2011, 3:16:03 AM (10 years ago)
Author:
sam
Message:

core: improve sin() and exp() performance by replacing divisions with
multiplications where appropriate.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/benchmark/real.cpp

    r977 r1020  
    5757            invfact = invfact / real(1.0 + i);
    5858        result[2] += timer.GetMs();
     59
     60        timer.GetMs();
     61        for (size_t i = 0; i < REAL_TABLE_SIZE / 128; i++)
     62            sin(real(0.01 * i));
     63        result[3] += timer.GetMs() * 128;
     64
     65        timer.GetMs();
     66        for (size_t i = 0; i < REAL_TABLE_SIZE / 128; i++)
     67            exp((real)(int)(i - REAL_TABLE_SIZE / 256));
     68        result[4] += timer.GetMs() * 128;
    5969    }
    6070
     
    6676    Log::Info("real = real * real           %7.3f\n", result[1]);
    6777    Log::Info("real = real / real           %7.3f\n", result[2]);
     78    Log::Info("real = sin(real)             %7.3f\n", result[3]);
     79    Log::Info("real = exp(real)             %7.3f\n", result[4]);
    6880}
    6981
Note: See TracChangeset for help on using the changeset viewer.