tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] performance


From: Daniel Zvinca
Subject: [Tinycc-devel] performance
Date: Mon, 22 Jan 2018 16:29:30 +0200

Hi there,

I'm in the process of translating certain AST code into C code, compile on fly and execute the compiled code. Everything works just fine, except the performance. In terms of performance, a very simple code seems to be at least 2 times slower than compiled Pelles C code (similar benchmark has also MSVC). Are they any optimizations or so I can bring to below code (or compilation/linker parameters) to have a similar speed (+/- 15% is ok) 

Here is the test code:
void test(double * res, double * a, double b, double * c, double d, int count)
{
for(int i=0;i<count;i++) 
              res[i] = a[i]*b + c[i]*d;
}

The results of the test were similar for tcc_compile_string and for generated by tcc dll (~165ms, average for 5 times loop, against ~84ms any other solution)

Count had a value of 50,000,000. And values used for testing were generated using the following code (outside the library)
double b_ = 2.5;
double d_ = 5.0;
#define NTESTING 50000000
for (int i=0;i<NTESTING;i++)
 {
  a_[i]=NTESTING+i+1;
  c_[i]=NTESTING+2*(i+1);
 }

Thanks,
Dan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]