Skip to content

Instantly share code, notes, and snippets.

@cosimo
Created March 7, 2011 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cosimo/859274 to your computer and use it in GitHub Desktop.
Save cosimo/859274 to your computer and use it in GitHub Desktop.
/* Per Buer's code, "Re: Lots of configs"
* http://pastebin.com/a68y15hp
*/
#include <stdio.h>
#include <string.h>
#include <pcre.h>
int main() {
const char *error;
int erroffset;
pcre *re;
int rc;
int i;
char str[] = "www.ibm.com";
int ovector[30];
int runs = 10000000;
int n;
re = pcre_compile ( "^www\\.ibm\\.com",
0, &error, &erroffset, 0);
if (!re) {
printf("pcre_compile failed (offset: %d), %s\n", erroffset, error);
return -1;
}
printf("Running %i matches....\n", runs);
for (n=0; n < runs; n++)
rc = pcre_exec (re, 0, str, strlen(str),
0, 0, ovector, 30);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment