Sable / dls18-ostrich

Experimental results for the second version of ostrich in the context of ubiquitous Javascript
3 stars 2 forks source link

Inside: why lavamd is slow on Ubuntu-deer? #1

Open wukefe opened 6 years ago

wukefe commented 6 years ago

Problem Description

Execution time (Chrome63 used on Ubuntu-deer)

Name js (s) wasm (s) gcc-native (s)
lavamd 1.6998 1.3137 3.4651

Experiments on Ubuntu

Setup

Observations

benchmark impl. compiler platform env. input mean std rep.
lavamd c gcc sable-intel native medium 3.1095s +-0.12% 10
lavamd c clang35 sable-intel native medium 3.2519s +-0.14% 10
lavamd c clang38 sable-intel native medium 3.1092s +-0.07% 10
lavamd c gcc sable-deer native medium 3.4823s +-0.94% 10
lavamd c clang35 sable-deer native medium 3.6138s +-1.03% 10
lavamd c clang38 sable-deer native medium 3.4792s +-0.87% 10

Related to Math Library

In lavamd, the math function exp occupies the most of computation time. We observed that the performance of exp on different platforms returned significant varying results.

#define N 1000000
#define op exp   // Operation
double res[N];

int main(){
    clock_t t0 = clock(); // Timing starts
    for(int i=0;i<N;i++){
        res[i] = op(i * 0.2); // Core
    }
    clock_t t1 = clock(); // Timing ends
    double s = 0;
    for(int i=0;i<N;i++){
        s = res[i];
    }
    printf("time: %lf ms\n", (t1-t0)*1.0/CLOCKS_PER_SEC*1000.0);
    return s > 100;
}

There are two versions of the code:

Performance results (gcc 5.4, -O3)

Platforms Ver-op (ms) Ver-no-op (ms)
mbp-2015 6.9 3.4
Ubuntu-deer 103.3 7.4

We can see that the math operation exp is a very expensive operation on Ubuntu-deer. However, on Mac OS, the execution time doesn't go up much with this operation. :)