I have a Python code and a C code.
My Python code is this:
import os
import time
count = 0
number_of_itration =100000000
begin = time.time()
for i in range(number_of_itration):
count += 1
end = time.time()
print(f'Sum is {count}')
print(f"Total runtime of the program is {end - begin} Seconds")
This code takes 12 seconds to execute.
I have a similar C Code:
int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0)
return -1;
start_t = clock();
for(i=0; i< 100000000; i++)
{
count= count+1;
}
end_t = clock();
total_t = (double)(end_t - start_t) / CLOCKS_PER_SEC;
printf("Total time taken by CPU: %f\n", total_t );
RunUserInterface ();
return 0;
}
This takes 0.395 seconds.
And I have a labview code:

Which takes just 0.093 seconds.
Where am I going wrong? I was expecting C to run faster.
My C IDE is Lab windows CVI, which is from National Instruments.
My system configuration is:

How can I optimize C code for processor?