-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
792 additions
and
933 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,34 @@ | ||
#define SI_IMPLEMENTATION 1 | ||
#include <sili.h> | ||
#include <immintrin.h> | ||
|
||
i32 res[4]; | ||
static i32 first[] = {10, 20, 30, 40}; | ||
static i32 second[] = {5, 5, 5, 5}; | ||
|
||
void performance_test(void) { | ||
isize i; | ||
for (i = 0; i < UINT16_MAX; i++); | ||
void performanceTest(void) { | ||
for_range (i, 0, countof(res)) { | ||
res[i] = first[i] + second[i]; | ||
} | ||
} | ||
|
||
void performanceTest2(void) { | ||
__m128i result = _mm_add_epi32(*(__m128i*)first, *(__m128i*)second); | ||
memcpy(res, (i32*)&result, sizeof(__m128i)); | ||
} | ||
|
||
int main(void) { | ||
printf("Running 'performance_test()' 30000 times. Lets see how long it takes to execute that many times...\n"); | ||
si_performance_run_per_loop(30000, performance_test()); | ||
print("Running 'performanceTest()' 30000 times. Lets see how long it takes to execute that many times..."); | ||
si_benchmarkRunsPerLoop(30000, performanceTest()); | ||
|
||
print("Now let's see how many times 'performanceTest()' can be executed in 5 seconds..."); | ||
si_benchmarkExecutesPerMs(5000, performanceTest()); | ||
|
||
printf("Now lets see how many times 'performance_test()' can be executed in 5 seconds...\n"); | ||
si_performance_executes_per_ms(5000, performance_test()); | ||
print("The average performance:"); | ||
si_benchmarkLoopsAvg(10000, performanceTest()); | ||
|
||
printf("The average performance:\n"); | ||
si_performance_loops_average(10000, performance_test()); | ||
print("Now we will compare the performance between 'performanceTest()' and 'performanceTest2()':"); | ||
si_benchmarkLoopsAvgCmp(10000, performanceTest(), performanceTest2()); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.