Reputation: 10400
I wrote a Matrix class in C++, I made a benchmark to test this code on a Raspberry Pi, when I used arch Linux the calculation time was 0.4ms, When I used ChibiOS which is RTOS the runtime of the code was 2.5ms. The CPU frequency both case was the same(700Mhz). Can be that the memory operations(calloc, memcpy) is slower in one system?
Upvotes: 0
Views: 391
Reputation: 182753
Since you're using doubles, it's hard float versus soft float.
Note that you must not attempt to run hard float binaries on an OS that doesn't support hard float. If you do, it will appear to work until there's a context switch between two processes that use hard float. Since the OS won't save the floating point state on context switches, they'll step on each other's floating point contexts and results will be unpredictable.
I believe the linker will catch this, so unless you write the assembly yourself and don't use any libraries, it should be difficult to run into this problem accidentally.
Upvotes: 3