summaryrefslogtreecommitdiff
path: root/tests/test_varint.c
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2011-04-01 15:40:06 -0700
committerJoshua Haberman <joshua@reverberate.org>2011-04-01 15:40:06 -0700
commit9eb4d695c49a85f7f72ad68c3c31affd61fef984 (patch)
tree79b7fde57e6f31a19405688a5f9e29e3f9cf7ab2 /tests/test_varint.c
parent19517cc6f39871abf4a0705b49cfed9049ca6033 (diff)
First rough version of the JIT.
It can successfully parse SpeedMessage1. Preliminary results: 750MB/s on Core2 2.4GHz. This number is 2.5x proto2. This isn't apples-to-apples, because proto2 is parsing to a struct and we are just doing stream parsing, but for apps that are currently using proto2, this is the improvement they would see if they could move to stream-based processing. Unfortunately perf-regression-test.py is broken, and I'm not 100% sure why. It would be nice to fix it first (to ensure that there are no performance regressions for the table-based decoder) but I'm really impatient to get the JIT checked in.
Diffstat (limited to 'tests/test_varint.c')
-rw-r--r--tests/test_varint.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/test_varint.c b/tests/test_varint.c
index efe9418..f0a8993 100644
--- a/tests/test_varint.c
+++ b/tests/test_varint.c
@@ -33,7 +33,7 @@ static void test_varint_decoder(upb_decoderet (*decoder)(const char*)) {
const char *twelvebyte_buf = twelvebyte;
// A varint that terminates before hitting the end of the provided buffer,
// but in too many bytes (11 instead of 10).
- upb_decoderet r = upb_decode_varint_fast(twelvebyte_buf);
+ upb_decoderet r = decoder(twelvebyte_buf);
ASSERT(r.p == NULL);
}
@@ -41,23 +41,26 @@ static void test_varint_decoder(upb_decoderet (*decoder)(const char*)) {
#define TEST_VARINT_DECODER(decoder) \
/* Create non-inline versions for convenient inspection of assembly language \
* output. */ \
- upb_decoderet _upb_decode_varint_ ## decoder(const char *p) { \
- return upb_decode_varint_ ## decoder(p); \
+ upb_decoderet _upb_vdecode_ ## decoder(const char *p) { \
+ return upb_vdecode_ ## decoder(p); \
} \
void test_ ## decoder() { \
- test_varint_decoder(&_upb_decode_varint_ ## decoder); \
+ printf("Testing varint decoder: " #decoder "..."); \
+ fflush(stdout); \
+ test_varint_decoder(&_upb_vdecode_ ## decoder); \
+ printf("ok.\n"); \
} \
TEST_VARINT_DECODER(branch32);
TEST_VARINT_DECODER(branch64);
-TEST_VARINT_DECODER(nobranch1);
-TEST_VARINT_DECODER(nobranch2);
+TEST_VARINT_DECODER(check2_wright);
+TEST_VARINT_DECODER(check2_massimino);
int main() {
test_branch32();
test_branch64();
- test_nobranch1();
- test_nobranch2();
+ test_check2_wright();
+ test_check2_massimino();
}
#if 0
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback