summaryrefslogtreecommitdiff
path: root/upb/msg.c
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2011-08-20 18:43:11 -0700
committerJoshua Haberman <jhaberman@gmail.com>2011-08-20 18:43:11 -0700
commitadb6580d9728c3533faf779812bd7f4c9b27170d (patch)
tree2aa721539ed7f067e26c2d6b16c657307700150b /upb/msg.c
parenta5e6a7b029850f77059800d6611f406b91f87dfe (diff)
Let the JIT emit hasbit-setting code in addition to calling a callback.
This leads to a major (20-40%) improvement in the parsetoproto2 benchmark with small messages. We now are faster than proto2 in all apples-to-apples comparisons, at least given the (admittedly limited) set of benchmarks in this source tree.
Diffstat (limited to 'upb/msg.c')
-rw-r--r--upb/msg.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/upb/msg.c b/upb/msg.c
index de7607c..65c358e 100644
--- a/upb/msg.c
+++ b/upb/msg.c
@@ -102,7 +102,7 @@ bool upb_stdmsg_has(void *_m, upb_value fval) {
assert(_m != NULL); \
upb_fielddef *f = upb_value_getfielddef(fval); \
uint8_t *m = _m; \
- upb_stdmsg_sethas(_m, fval); \
+ /* Hasbit is set automatically by the handlers. */ \
*(ctype*)&m[f->offset] = upb_value_get ## type(val); \
return UPB_CONTINUE; \
} \
@@ -164,7 +164,7 @@ upb_flow_t upb_stdmsg_setstr(void *_m, upb_value fval, upb_value val) {
assert(_m != NULL);
char *m = _m;
upb_fielddef *f = upb_value_getfielddef(fval);
- upb_stdmsg_sethas(_m, fval);
+ // Hasbit automatically set by the handlers.
_upb_stdmsg_setstr(&m[f->offset], val);
return UPB_CONTINUE;
}
@@ -340,6 +340,7 @@ static void upb_accessors_onfreg(void *c, upb_fhandlers *fh, upb_fielddef *f) {
} else {
upb_fhandlers_setvalue(fh, f->accessor->set);
upb_fhandlers_setstartsubmsg(fh, f->accessor->startsubmsg);
+ upb_fhandlers_setvaluehasbit(fh, f->hasbit);
}
}
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback