1
0
Fork 0
mirror of git://git.psyc.eu/libpsyc synced 2024-08-15 03:19:02 +00:00

bench: fix for strlen & json-c tests

This commit is contained in:
tg(x) 2011-05-24 20:41:27 +02:00
parent 283b11c2cd
commit 05f6ba6be9
4 changed files with 33 additions and 18 deletions

View file

@ -155,17 +155,17 @@ Parsing large amounts of binary data. For JSON & XML base64 encoding was used.
Note that the results below include only the parsing time, base64 decoding was
not performed.
| input: | PSYC | | JSON | | | XML | |
| parser: | strlen | libpsyc | json-c | json-glib | libxml sax | libxml | rapidxml |
|---------+--------+---------+--------+------------+------------+-----------+----------|
| 7K | 92 | 77 | 14459 | 98000 | 11445 | 19299 | 8701 |
| 70K | 53 | 77 | 14509 | 1003900 | 96209 | 167738 | 74296 |
| 700K | 42 | 77 | 14551 | 10616000 | 842025 | 1909428 | 729419 |
| 7M | 258 | 78 | 14555 | 120810000 | 12466610 | 16751363 | 7581169 |
| 70M | 304 | 80 | 14534 | 1241000000 | 169622110 | 296017820 | 75308906 |
|---------+--------+---------+--------+------------+------------+-----------+----------|
| / | < | > | < | > | < | | > |
| <r> | | | | | | | |
| input: | PSYC | | JSON | | | XML | |
| parser: | strlen | libpsyc | json-c | json-glib | libxml sax | libxml | rapidxml |
|---------+----------+---------+-----------+------------+------------+-----------+----------|
| 7K | 978 | 77 | 18609 | 98000 | 11445 | 19299 | 8701 |
| 70K | 9613 | 77 | 187540 | 1003900 | 96209 | 167738 | 74296 |
| 700K | 95888 | 77 | 1883500 | 10616000 | 842025 | 1909428 | 729419 |
| 7M | 1347300 | 78 | 26359000 | 120810000 | 12466610 | 16751363 | 7581169 |
| 70M | 14414000 | 80 | 357010000 | 1241000000 | 169622110 | 296017820 | 75308906 |
|---------+----------+---------+-----------+------------+------------+-----------+----------|
| / | < | > | < | > | < | | > |
| <r> | | | | | | | |
These tests were performed on a 2.53 GHz Intel(R) Core(TM)2 Duo P9500 CPU.

View file

@ -87,16 +87,16 @@ bench-dir:
@mkdir -p ../bench/results
bench-psyc: bench-dir testStrlen testPsycSpeed
for f in ../bench/packets/*.psyc ../bench/packets/binary/*.psyc; do bf=`basename $$f`; echo strlen: $$bf; ./testStrlen -sc 1000000 -f $$f | ${TEE} -a ../bench/results/$$bf.strlen; done
for f in ../bench/packets/*.psyc ../bench/packets/binary/*.psyc; do bf=`basename $$f`; echo libpsyc: $$f; ./testPsycSpeed -sc 1000000 -f $$f | ${TEE} -a ../bench/results/$$bf; done
for f in ../bench/packets/*.psyc `ls ../bench/packets/binary/*.psyc | sort -r`; do bf=`basename $$f`; echo strlen: $$bf; ./testStrlen -sc 1000000 -f $$f | ${TEE} -a ../bench/results/$$bf.strlen; done
for f in ../bench/packets/*.psyc `ls ../bench/packets/binary/*.psyc | sort -r`; do bf=`basename $$f`; echo libpsyc: $$f; ./testPsycSpeed -sc 1000000 -f $$f | ${TEE} -a ../bench/results/$$bf; done
bench-json: bench-dir testStrlen testJson testJsonGlib
for f in ../bench/packets/*.json ../bench/packets/binary/*.json; do bf=`basename $$f`; echo strlen: $$bf; ./testStrlen -sc 1000000 -f $$f | ${TEE} -a ../bench/results/$$bf.strlen; done
for f in ../bench/packets/*.json ../bench/packets/binary/*.json; do bf=`basename $$f`; echo json-c: $$bf; ./testJson -snc 1000000 -f $$f | ${TEE} -a ../bench/results/$$bf; done
# for f in ../bench/packets/*.json `ls ../bench/packets/binary/*.json | sort -r`; do bf=`basename $$f`; echo strlen: $$bf; ./testStrlen -sc 1000000 -f $$f | ${TEE} -a ../bench/results/$$bf.strlen; done
for f in ../bench/packets/*.json `ls ../bench/packets/binary/*.json | sort -r`; do bf=`basename $$f`; echo json-c: $$bf; ./testJson -snc 1000000 -f $$f | ${TEE} -a ../bench/results/$$bf; done
for f in ../bench/packets/*.json; do bf=`basename $$f`; echo json-glib: $$bf; ./testJsonGlib -snc 1000000 -f $$f | ${TEE} -a ../bench/results/$$bf-glib; done
bench-xml: bench-dir testStrlen
for f in ../bench/packets/*.xml ../bench/packets/binary/*.xml; do bf=`basename $$f`; echo strlen: $$bf; ./testStrlen -sc 1000000 -f $$f | ${TEE} -a ../bench/results/$$bf.strlen; done
# for f in ../bench/packets/*.xml `ls ../bench/packets/binary/*.xml | sort -r`; do bf=`basename $$f`; echo strlen: $$bf; ./testStrlen -sc 1000000 -f $$f | ${TEE} -a ../bench/results/$$bf.strlen; done
bench-genpkts:
@${MAKE} genpkt header=../bench/packets/binary/psyc-header content=../bench/packets/binary/psyc-content bs=7000 of=../bench/packets/binary/7K.psyc

View file

@ -52,7 +52,7 @@ void *get_in_addr (struct sockaddr *sa) {
void test_file(const char* filename, size_t count, size_t recv_buf_size) {
char *buf, *recvbuf; // cont buf + recv buf: [ ccrrrr]
size_t i, nbytes, size = 0;
size_t i, nbytes, size;
struct timeval start, end;
struct stat st;
@ -64,7 +64,8 @@ void test_file(const char* filename, size_t count, size_t recv_buf_size) {
fstat(fd, &st);
buf = malloc(CONT_BUF_SIZE + st.st_size);
size = CONT_BUF_SIZE + st.st_size;
buf = malloc(size);
if (!buf) {
perror("malloc");
exit(1);
@ -77,13 +78,26 @@ void test_file(const char* filename, size_t count, size_t recv_buf_size) {
if (stats)
gettimeofday(&start, NULL);
#ifdef NOREAD
memset(buf, 1, size);
#else
size = 0;
#endif
for (i = 0; i < count; i++)
#ifndef NOREAD
while ((nbytes = read(fd, (void*)recvbuf, recv_buf_size)))
#endif
test_input(0, recvbuf, nbytes);
} else {
#ifdef NOREAD
memset(buf, 1, size);
#else
size = 0;
while ((nbytes = read(fd, (void*)recvbuf + size, RECV_BUF_SIZE)))
size += nbytes;
#endif
if (stats)
gettimeofday(&start, NULL);

View file

@ -10,6 +10,7 @@
#include <getopt.h>
#include <sys/socket.h>
#define NOREAD
#include "test.c"
// cmd line args