Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why -O0 and -O2 have the same performance? #479

Open
rppp opened this issue Dec 1, 2022 · 1 comment
Open

Why -O0 and -O2 have the same performance? #479

rppp opened this issue Dec 1, 2022 · 1 comment

Comments

@rppp
Copy link

rppp commented Dec 1, 2022

./cling -O0 '#include <stdio.h> ' '#include <time.h>' 'int fib(int n){if(n<=1){return 1;}return fib(n-1)+fib(n-2);} auto start=clock();printf("%d\n",fib(40));printf("%f\n",(clock()-start)/(double)CLOCKS_PER_SEC);'

./cling -O2 '#include <stdio.h> ' '#include <time.h>' 'int fib(int n){if(n<=1){return 1;}return fib(n-1)+fib(n-2);} auto start=clock();printf("%d\n",fib(40));printf("%f\n",(clock()-start)/(double)CLOCKS_PER_SEC);'

Can I use the “-force-interpreter” of LLVM/lli option?

@rppp
Copy link
Author

rppp commented Dec 1, 2022

In my experience, it seems that the performance of cling is the same as that of g++ -O0, so cling uses JIT -O0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant