Skip to content

Instantly share code, notes, and snippets.

@mlabbe
Created June 30, 2015 19:26
Show Gist options
  • Select an option

  • Save mlabbe/eec8ff3576fd6253e920 to your computer and use it in GitHub Desktop.

Select an option

Save mlabbe/eec8ff3576fd6253e920 to your computer and use it in GitHub Desktop.
perf stricmp
#ifdef WIN32
void perf_stricmp_w32(void)
{
const unsigned long REPS=10000000; /* default is 10mil */
char s1[] = "dogeatdogisSTORYOFMYLIFE";
char s2[] = "DOGEATDOGISSTORYOFMYLIFE";
unsigned long i;
LARGE_INTEGER frequency;
LARGE_INTEGER start;
LARGE_INTEGER end;
double interval;
printf("running perf_stricmp %lu times\n", REPS);
QueryPerformanceFrequency(&frequency);
QueryPerformanceCounter(&start);
for (i = 0; i < REPS; ++i)
{
int result = ftg_stricmp(s1, s2);
}
QueryPerformanceCounter(&end);
interval = (double) (end.QuadPart - start.QuadPart) / frequency.QuadPart;
printf("interval: %f\n", interval);
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment