diff options
| author | flatmush <flatmush@d3e1167c-abe1-51d5-8199-f9061ebe54e4> | 2011-02-24 16:23:50 +0000 |
|---|---|---|
| committer | flatmush <flatmush@d3e1167c-abe1-51d5-8199-f9061ebe54e4> | 2011-02-24 16:23:50 +0000 |
| commit | d3482256c277dff8cd6243dae0f72df1a4c676d3 (patch) | |
| tree | fb34a3f7ac03243e55f7cc3053e48c596a490e17 /fixtest/hiclock.h | |
| parent | 0e06a1e8b7fe9bb31437d8612d62bee85df2e43f (diff) | |
| download | libfixmath-d3482256c277dff8cd6243dae0f72df1a4c676d3.tar.gz | |
Added a small program called fixtest which currently tests performance and average error on x86 platforms, currently it produces quite wildly varying results depending on the input values.
The average error seems to vary between 3-8%, it's possible that setting iter to a higher value (and pass to a lower one) could give a more stable value.
Fixed point seems to be slower overall on x86 (50% of float) with good floating point hardware, however with the caching enabled depending on the program the fixed point implementation may be much faster (as float would be if cached).
With caching enabled there is a massive difference between and iter size below and above 4096, this is because the caching mechanism thrashes above this threshold, it probably makes sense to disable caching for these tests by compiling libfixmath with FIXMATH_NO_CACHE.
Diffstat (limited to 'fixtest/hiclock.h')
| -rw-r--r-- | fixtest/hiclock.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/fixtest/hiclock.h b/fixtest/hiclock.h new file mode 100644 index 0000000..89e32c8 --- /dev/null +++ b/fixtest/hiclock.h @@ -0,0 +1,33 @@ +#ifndef __hiclock_h__
+#define __hiclock_h__
+
+#include <stdint.h>
+#include <inttypes.h>
+
+#if defined(__unix__)
+#include <sys/time.h>
+#define PRIuHICLOCK PRIu64
+#define PRIiHICLOCK PRIi64
+typedef uint64_t hiclock_t;
+#define HICLOCKS_PER_SEC 1000000
+#define hiclock_init()
+#elif defined(__WIN32) || defined(__WIN64)
+#include <windows.h>
+#define PRIuHICLOCK PRIu64
+#define PRIiHICLOCK PRIi64
+typedef LONGLONG hiclock_t;
+extern LONGLONG HICLOCKS_PER_SEC;
+extern void hiclock_init();
+#else
+#include <time.h>
+#define PRIuHICLOCK PRIu32
+#define PRIiHICLOCK PRIi32
+typedef clock_t hiclock_t;
+#define HICLOCKS_PER_SEC CLOCKS_PER_SEC
+#define hiclock_init()
+#endif
+
+extern hiclock_t hiclock();
+
+#endif
+
|
