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:
parent
283b11c2cd
commit
05f6ba6be9
4 changed files with 33 additions and 18 deletions
|
@ -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
|
Note that the results below include only the parsing time, base64 decoding was
|
||||||
not performed.
|
not performed.
|
||||||
|
|
||||||
| input: | PSYC | | JSON | | | XML | |
|
| input: | PSYC | | JSON | | | XML | |
|
||||||
| parser: | strlen | libpsyc | json-c | json-glib | libxml sax | libxml | rapidxml |
|
| parser: | strlen | libpsyc | json-c | json-glib | libxml sax | libxml | rapidxml |
|
||||||
|---------+--------+---------+--------+------------+------------+-----------+----------|
|
|---------+----------+---------+-----------+------------+------------+-----------+----------|
|
||||||
| 7K | 92 | 77 | 14459 | 98000 | 11445 | 19299 | 8701 |
|
| 7K | 978 | 77 | 18609 | 98000 | 11445 | 19299 | 8701 |
|
||||||
| 70K | 53 | 77 | 14509 | 1003900 | 96209 | 167738 | 74296 |
|
| 70K | 9613 | 77 | 187540 | 1003900 | 96209 | 167738 | 74296 |
|
||||||
| 700K | 42 | 77 | 14551 | 10616000 | 842025 | 1909428 | 729419 |
|
| 700K | 95888 | 77 | 1883500 | 10616000 | 842025 | 1909428 | 729419 |
|
||||||
| 7M | 258 | 78 | 14555 | 120810000 | 12466610 | 16751363 | 7581169 |
|
| 7M | 1347300 | 78 | 26359000 | 120810000 | 12466610 | 16751363 | 7581169 |
|
||||||
| 70M | 304 | 80 | 14534 | 1241000000 | 169622110 | 296017820 | 75308906 |
|
| 70M | 14414000 | 80 | 357010000 | 1241000000 | 169622110 | 296017820 | 75308906 |
|
||||||
|---------+--------+---------+--------+------------+------------+-----------+----------|
|
|---------+----------+---------+-----------+------------+------------+-----------+----------|
|
||||||
| / | < | > | < | > | < | | > |
|
| / | < | > | < | > | < | | > |
|
||||||
| <r> | | | | | | | |
|
| <r> | | | | | | | |
|
||||||
|
|
||||||
|
|
||||||
These tests were performed on a 2.53 GHz Intel(R) Core(TM)2 Duo P9500 CPU.
|
These tests were performed on a 2.53 GHz Intel(R) Core(TM)2 Duo P9500 CPU.
|
||||||
|
|
|
@ -87,16 +87,16 @@ bench-dir:
|
||||||
@mkdir -p ../bench/results
|
@mkdir -p ../bench/results
|
||||||
|
|
||||||
bench-psyc: bench-dir testStrlen testPsycSpeed
|
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 `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 ../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 libpsyc: $$f; ./testPsycSpeed -sc 1000000 -f $$f | ${TEE} -a ../bench/results/$$bf; done
|
||||||
|
|
||||||
bench-json: bench-dir testStrlen testJson testJsonGlib
|
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 `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 ../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 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
|
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
|
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:
|
bench-genpkts:
|
||||||
@${MAKE} genpkt header=../bench/packets/binary/psyc-header content=../bench/packets/binary/psyc-content bs=7000 of=../bench/packets/binary/7K.psyc
|
@${MAKE} genpkt header=../bench/packets/binary/psyc-header content=../bench/packets/binary/psyc-content bs=7000 of=../bench/packets/binary/7K.psyc
|
||||||
|
|
18
test/test.c
18
test/test.c
|
@ -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) {
|
void test_file(const char* filename, size_t count, size_t recv_buf_size) {
|
||||||
char *buf, *recvbuf; // cont buf + recv buf: [ ccrrrr]
|
char *buf, *recvbuf; // cont buf + recv buf: [ ccrrrr]
|
||||||
size_t i, nbytes, size = 0;
|
size_t i, nbytes, size;
|
||||||
struct timeval start, end;
|
struct timeval start, end;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
|
@ -64,7 +64,8 @@ void test_file(const char* filename, size_t count, size_t recv_buf_size) {
|
||||||
|
|
||||||
fstat(fd, &st);
|
fstat(fd, &st);
|
||||||
|
|
||||||
buf = malloc(CONT_BUF_SIZE + st.st_size);
|
size = CONT_BUF_SIZE + st.st_size;
|
||||||
|
buf = malloc(size);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
perror("malloc");
|
perror("malloc");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -77,13 +78,26 @@ void test_file(const char* filename, size_t count, size_t recv_buf_size) {
|
||||||
if (stats)
|
if (stats)
|
||||||
gettimeofday(&start, NULL);
|
gettimeofday(&start, NULL);
|
||||||
|
|
||||||
|
#ifdef NOREAD
|
||||||
|
memset(buf, 1, size);
|
||||||
|
#else
|
||||||
|
size = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
|
#ifndef NOREAD
|
||||||
while ((nbytes = read(fd, (void*)recvbuf, recv_buf_size)))
|
while ((nbytes = read(fd, (void*)recvbuf, recv_buf_size)))
|
||||||
|
#endif
|
||||||
test_input(0, recvbuf, nbytes);
|
test_input(0, recvbuf, nbytes);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef NOREAD
|
||||||
|
memset(buf, 1, size);
|
||||||
|
#else
|
||||||
|
size = 0;
|
||||||
while ((nbytes = read(fd, (void*)recvbuf + size, RECV_BUF_SIZE)))
|
while ((nbytes = read(fd, (void*)recvbuf + size, RECV_BUF_SIZE)))
|
||||||
size += nbytes;
|
size += nbytes;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (stats)
|
if (stats)
|
||||||
gettimeofday(&start, NULL);
|
gettimeofday(&start, NULL);
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
|
#define NOREAD
|
||||||
#include "test.c"
|
#include "test.c"
|
||||||
|
|
||||||
// cmd line args
|
// cmd line args
|
||||||
|
|
Loading…
Reference in a new issue