/[pcre]/code/trunk/pcretest.c
ViewVC logotype

Diff of /code/trunk/pcretest.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 25 by nigel, Sat Feb 24 21:38:45 2007 UTC revision 27 by nigel, Sat Feb 24 21:38:49 2007 UTC
# Line 22  Line 22 
22  #endif  #endif
23  #endif  #endif
24    
25  #define LOOPREPEAT 10000  #define LOOPREPEAT 20000
26    
27    
28  static FILE *outfile;  static FILE *outfile;
# Line 499  while (!done) Line 499  while (!done)
499          if (re != NULL) free(re);          if (re != NULL) free(re);
500          }          }
501        time_taken = clock() - start_time;        time_taken = clock() - start_time;
502        fprintf(outfile, "Compile time %.2f milliseconds\n",        fprintf(outfile, "Compile time %.3f milliseconds\n",
503          ((double)time_taken)/(4 * CLOCKS_PER_SEC));          ((double)time_taken * 1000.0) /
504            ((double)LOOPREPEAT * (double)CLOCKS_PER_SEC));
505        }        }
506    
507      re = pcre_compile((char *)p, options, &error, &erroroffset, tables);      re = pcre_compile((char *)p, options, &error, &erroroffset, tables);
# Line 586  while (!done) Line 587  while (!done)
587            extra = pcre_study(re, study_options, &error);            extra = pcre_study(re, study_options, &error);
588          time_taken = clock() - start_time;          time_taken = clock() - start_time;
589          if (extra != NULL) free(extra);          if (extra != NULL) free(extra);
590          fprintf(outfile, "  Study time %.2f milliseconds\n",          fprintf(outfile, "  Study time %.3f milliseconds\n",
591            ((double)time_taken)/(4 * CLOCKS_PER_SEC));            ((double)time_taken * 1000.0)/
592              ((double)LOOPREPEAT * (double)CLOCKS_PER_SEC));
593          }          }
594    
595        extra = pcre_study(re, study_options, &error);        extra = pcre_study(re, study_options, &error);
# Line 765  while (!done) Line 767  while (!done)
767          register int i;          register int i;
768          clock_t time_taken;          clock_t time_taken;
769          clock_t start_time = clock();          clock_t start_time = clock();
770          for (i = 0; i < 4000; i++)          for (i = 0; i < LOOPREPEAT; i++)
771            count = pcre_exec(re, extra, (char *)dbuffer, len, options, offsets,            count = pcre_exec(re, extra, (char *)dbuffer, len, options, offsets,
772              size_offsets);              size_offsets);
773          time_taken = clock() - start_time;          time_taken = clock() - start_time;
774          fprintf(outfile, "Execute time %.2f milliseconds\n",          fprintf(outfile, "Execute time %.3f milliseconds\n",
775            ((double)time_taken)/(4 * CLOCKS_PER_SEC));            ((double)time_taken * 1000.0)/
776              ((double)LOOPREPEAT * (double)CLOCKS_PER_SEC));
777          }          }
778    
779        count = pcre_exec(re, extra, (char *)dbuffer, len, options, offsets,        count = pcre_exec(re, extra, (char *)dbuffer, len, options, offsets,

Legend:
Removed from v.25  
changed lines
  Added in v.27

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12