Skip to content

Commit

Permalink
Mac M2 benchmarks (#175)
Browse files Browse the repository at this point in the history
Added Mac M2 benchmarks. Limit to 4 threads (performance cores). Adding
efficiency cores slows performance.
  • Loading branch information
erincatto committed Jul 28, 2024
1 parent b36d549 commit b83e6b1
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 24 deletions.
5 changes: 5 additions & 0 deletions benchmark/m2air/joint_grid.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
threads,fps
1,510.67
2,955.752
3,1384.14
4,1651.69
5 changes: 5 additions & 0 deletions benchmark/m2air/large_pyramid.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
threads,fps
1,284.342
2,526.955
3,728.772
4,911.715
5 changes: 5 additions & 0 deletions benchmark/m2air/many_pyramids.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
threads,fps
1,73.9053
2,139.551
3,193.414
4,234.215
5 changes: 5 additions & 0 deletions benchmark/m2air/smash.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
threads,fps
1,161.17
2,256.422
3,321.137
4,385.797
5 changes: 5 additions & 0 deletions benchmark/m2air/tumbler.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
threads,fps
1,340.404
2,538.587
3,661.721
4,781.784
26 changes: 4 additions & 22 deletions benchmark/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#if defined(_WIN64)
#include <windows.h>
#elif defined(__APPLE__)
// #include <sys/param.h>
// #include <sys/sysctl.h>
#include <unistd.h>
#elif defined(__linux__)
#include <unistd.h>
Expand Down Expand Up @@ -60,27 +60,9 @@ int GetNumberOfCores()
GetSystemInfo(&sysinfo);
return sysinfo.dwNumberOfProcessors;
#elif defined(__APPLE__)
// int nm[2];
// size_t len = 4;
// uint32_t count;

// nm[0] = CTL_HW;
// nm[1] = HW_AVAILCPU;
// sysctl(nm, 2, &count, &len, NULL, 0);

// if (count < 1)
//{
// nm[1] = HW_NCPU;
// sysctl(nm, 2, &count, &len, NULL, 0);
// if (count < 1)
// {
// count = 1;
// }
// }
// return count;
return sysconf(_SC_NPROCESSORS_ONLN);
return (int)sysconf(_SC_NPROCESSORS_ONLN);
#elif defined(__linux__)
return sysconf(_SC_NPROCESSORS_ONLN);
(int)return sysconf(_SC_NPROCESSORS_ONLN);
#else
return 1;
#endif
Expand Down
4 changes: 2 additions & 2 deletions samples/sample_shapes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,8 +715,8 @@ class CustomFilter : public Sample
return true;
}

int indexA = reinterpret_cast<intptr_t>(userDataA);
int indexB = reinterpret_cast<intptr_t>(userDataB);
int indexA = static_cast<int>(reinterpret_cast<intptr_t>(userDataA));
int indexB = static_cast<int>(reinterpret_cast<intptr_t>(userDataB));

return ((indexA & 1) + (indexB & 1)) != 1;
}
Expand Down

0 comments on commit b83e6b1

Please sign in to comment.