User Tools

Site Tools


programming:general:phpvspythonvsperl

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
programming:general:phpvspythonvsperl [2008/02/01 21:24] crustymonkeyprogramming:general:phpvspythonvsperl [2008/04/14 13:55] (current) crustymonkey
Line 367: Line 367:
 ===== Just For Fun... ===== ===== Just For Fun... =====
 ...one of my co-workers whipped up this C code which uses ''libpcre'' just to see how it would perform versus the interpreted languages.  I'm not including it in the main results because this is a test of 3 interpreted languages speed capabilities, but I thought I would drop the results in here just for fun. ...one of my co-workers whipped up this C code which uses ''libpcre'' just to see how it would perform versus the interpreted languages.  I'm not including it in the main results because this is a test of 3 interpreted languages speed capabilities, but I thought I would drop the results in here just for fun.
 +
 +
 +
  
 ==== The Code ==== ==== The Code ====
Line 399: Line 402:
                 re[i] = pcre_compile(pat[i], 0, &err_txt, &err_offset, 0);                 re[i] = pcre_compile(pat[i], 0, &err_txt, &err_offset, 0);
                 if (!re[i]) {                 if (!re[i]) {
-                        errx(1, "PCRE complie error at %d of %s: %s",+                        errx(1, "PCRE compile error at %d of %s: %s",
                                 err_offset, pat[i], err_txt);                                 err_offset, pat[i], err_txt);
                 }                 }
Line 412: Line 415:
                         if (match > 0) {                         if (match > 0) {
                                 counter++;                                 counter++;
-                        } +                                break;
-                } +
-        } +
- +
-        if (!(f = fopen(logfile, "r"))) return 1; +
- +
-        while ((s = fgets(buf, sizeof(buf), f))) { +
-                for (i = 0; pat[i]; i++) { +
-                        match = pcre_exec(re[i], 0, s, strlen(s), +
-                                        0, 0, ovec, 30); +
-                        if (match > 0) { +
-                                counter++;+
                         }                         }
                 }                 }
Line 440: Line 432:
 $ cc -Wall -o pcretest pcretest.c -I/usr/local/include -L/usr/local/lib -lpcre $ cc -Wall -o pcretest pcretest.c -I/usr/local/include -L/usr/local/lib -lpcre
 </code> </code>
 +
 +
 +
  
  
Line 446: Line 441:
 === The Sun Box === === The Sun Box ===
 | ^ Real ^ User ^ Sys ^ | ^ Real ^ User ^ Sys ^
-^ Test 1 | 7.93s 7.65s | 0.10s +^ Test 1 |  **6.70s**   **6.44s**   0.07s  
-^ Test 2 | 9.46s 8.54s | 0.10s +^ Test 2 |  8.03s   7.83s   **0.03s**  
-^ Test 3 | 8.28s 7.55s | 0.09s +^ Test 3 |  9.04s   6.84s   0.05s  
-^ Test 4 | 8.09s 7.65s | 0.06s +^ Test 4 |  9.03s   6.53s   0.09s  
-^ Test 5 | 7.93s 7.65s | 0.09s |+^ Test 5 |  7.26s   6.63s   0.08s  |
  
 +=== The Laptop ===
 +
 +| ^ Real ^ User ^ Sys ^
 +^ Test 1 |  13.14s  |  12.92s  |  0.06s  |
 +^ Test 2 |  13.08s  |  **12.88s**  |  0.06s  |
 +^ Test 3 |  13.09s  |  12.94s  |  **0.02s**  |
 +^ Test 4 |  13.21s  |  13.00s  |  0.07s  |
 +^ Test 5 |  **13.07s**  |  **12.88s**  |  0.04s  |
  
 ===== Conclusion ===== ===== Conclusion =====
programming/general/phpvspythonvsperl.1201901079.txt.gz · Last modified: 2008/02/01 21:24 by crustymonkey