Replies: 1 comment
-
Thanks for writing this up. I can't really explain the behavior. I cannot remember why I wrote that MUP_BASETYPE should not be an int. I don't see fundamental issues other than that the mathematical functions will not work (sin, cos, log) because i'm mapping the standard library functions via a template and there are no standard library functions for int types. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I maintain raine, an emulator also here in sourceforge and we've been using muparser internally for our parser for quite some time already, but recently some scripts which were more cpu intensive than usual showed a big performance difference between windows and linux.
After digging for a few days, it seems it looses time in the conversions between double and ints (most operations are on ints in the emulator, I assumed that modern cpus can handle doubles almost as well as ints, and that's the case in linux, there seems to be a small problem in mingw32 for that). Well, since you encourage people to merge muparser in their project to be able to change the base type, that's what I did, and I changed it to "unsigned int" despite the comment above it which said it wouldn't work with int.
It worked. And it allowed a few more optimizations because the base functions I added didn't need to cope with type conversions anymore.
The result : windows and linux versions have now exactly the same performance, and are faster than ever !
The only drawback seems to be that float numbers are not recognized anymore in the console of course, but I can live with that.
The difference in performance was quite huge with doubles, I had a debug build in linux which was at 9% cpu time for the scripts, when the optimized build in windows was at a little more than 50% cpu time for the same time !
I didn't understand how there can be a difference in these type conversions in performance, this is the same compiler (gcc/g++ in linux and the equivalent mingw32 version in windows) with the same source. But apparently this is the case...
I decided it ʍas worth posting a message here.
Beta Was this translation helpful? Give feedback.
All reactions