From 9eb4d695c49a85f7f72ad68c3c31affd61fef984 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Fri, 1 Apr 2011 15:40:06 -0700 Subject: 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. --- src/upb_msg.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/upb_msg.c') diff --git a/src/upb_msg.c b/src/upb_msg.c index 6fc321e..aac2c91 100644 --- a/src/upb_msg.c +++ b/src/upb_msg.c @@ -299,6 +299,13 @@ upb_msg *upb_msg_appendmsg(upb_msg *msg, upb_fielddef *f, upb_msgdef *msgdef) { static upb_flow_t upb_dmsgsink_value(void *_m, upb_value fval, upb_value val) { upb_msg *m = _m; upb_fielddef *f = upb_value_getfielddef(fval); + if (upb_isstring(f)) { + //fprintf(stderr, "dmsg_value! this=%p f=%p name=" UPB_STRFMT ", + // " UPB_STRFMT " %p\n", m, f, UPB_STRARG(f->name), UPB_STRARG(val.val.str)); + } else { + //fprintf(stderr, "dmsg_value! this=%p f=%p name=" UPB_STRFMT ", + // %llu\n", m, f, UPB_STRARG(f->name), val.val.uint64); + } upb_msg_appendval(m, f, val); return UPB_CONTINUE; } @@ -306,8 +313,11 @@ static upb_flow_t upb_dmsgsink_value(void *_m, upb_value fval, upb_value val) { static upb_sflow_t upb_dmsgsink_startsubmsg(void *_m, upb_value fval) { upb_msg *m = _m; upb_fielddef *f = upb_value_getfielddef(fval); + //fprintf(stderr, "dmsg_startsubmsg! " UPB_STRFMT " %p\n", UPB_STRARG(fval.val.fielddef->name), f); upb_msgdef *msgdef = upb_downcast_msgdef(f->def); - return UPB_CONTINUE_WITH(upb_msg_appendmsg(m, f, msgdef)); + void *p = upb_msg_appendmsg(m, f, msgdef); + //printf("Continuing with: %p\n", p); + return UPB_CONTINUE_WITH(p); } void upb_msg_regdhandlers(upb_handlers *h) { -- cgit v1.2.3