diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2012-03-24 11:24:16 -0700 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2012-03-24 11:24:16 -0700 |
commit | 86bad61b76a260ffc442acffbe58feee67df45e5 (patch) | |
tree | e375e62ff6d7fea9fb810830e66118e67b4ec2c8 /bindings/python | |
parent | db59a5198f890ecdcac1227b0bb998160acac5c6 (diff) |
Sync from internal Google development.
Many improvements, too many to mention. One significant
perf regression warrants investigation:
omitfp.parsetoproto2_googlemessage1.upb_jit: 343 -> 252 (-26.53)
plain.parsetoproto2_googlemessage1.upb_jit: 334 -> 251 (-24.85)
25% regression for this benchmark is bad, but since I don't think
there's any fundamental design issue that caused it I'm going to
go ahead with the commit anyway. Can investigate and fix later.
Other benchmarks were neutral or showed slight improvement.
Diffstat (limited to 'bindings/python')
-rw-r--r-- | bindings/python/upb.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/bindings/python/upb.c b/bindings/python/upb.c index 8f36f70..497074b 100644 --- a/bindings/python/upb.c +++ b/bindings/python/upb.c @@ -612,9 +612,8 @@ static upb_sflow_t PyUpb_Message_StartRepeatedSubmessage(void *a, upb_value fval static upb_flow_t PyUpb_Message_StringValue(void *m, upb_value fval, upb_value val) { PyObject **str = PyUpb_Accessor_GetPtr(m, fval); if (*str) { Py_DECREF(*str); } - upb_byteregion *r = upb_value_getbyteregion(val); - *str = PyString_FromStringAndSize(NULL, upb_byteregion_len(r)); - upb_byteregion_copyall(r, PyString_AsString(*str)); + *str = PyString_FromStringAndSize(NULL, upb_value_getstrref(val)->len); + upb_strref_read(upb_value_getstrref(val), PyString_AsString(*str)); upb_stdmsg_sethas(m, fval); return UPB_CONTINUE; } @@ -622,9 +621,8 @@ static upb_flow_t PyUpb_Message_StringValue(void *m, upb_value fval, upb_value v static upb_flow_t PyUpb_Message_AppendStringValue(void *a, upb_value fval, upb_value val) { (void)fval; PyObject **elem = upb_stdarray_append(a, sizeof(void*)); - upb_byteregion *r = upb_value_getbyteregion(val); - *elem = PyString_FromStringAndSize(NULL, upb_byteregion_len(r)); - upb_byteregion_copyall(r, PyString_AsString(*elem)); + *elem = PyString_FromStringAndSize(NULL, upb_value_getstrref(val)->len); + upb_strref_read(upb_value_getstrref(val), PyString_AsString(*elem)); return UPB_CONTINUE; } |