diff options
author | Joshua Haberman <joshua@reverberate.org> | 2011-02-14 22:06:36 -0800 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2011-02-14 22:06:36 -0800 |
commit | bdb28b5a45aa81416e3b8e239e18bd668b2b95d2 (patch) | |
tree | 6888aaa2c3eb95c0f09ed7e9ddcc0fb65e7465f7 /benchmarks/parsetostruct.upb_table.c | |
parent | a80bcc50853500f3213a9a24c0752057e3c49b7c (diff) |
Make "byval" benchmarks actually byval.
Diffstat (limited to 'benchmarks/parsetostruct.upb_table.c')
-rw-r--r-- | benchmarks/parsetostruct.upb_table.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/benchmarks/parsetostruct.upb_table.c b/benchmarks/parsetostruct.upb_table.c index 406229b..592f86e 100644 --- a/benchmarks/parsetostruct.upb_table.c +++ b/benchmarks/parsetostruct.upb_table.c @@ -58,11 +58,23 @@ static bool initialize() upb_decoder_init(&d, def); upb_msgpopulator_init(&p); upb_handlers_init(&h); + + if (!BYREF) { + // Pretend the input string is stack-allocated, which will force its data + // to be copied instead of referenced. There is no good reason to do this, + // except to benchmark against proto2 more fairly, which in its open-source + // release does not support referencing the input string. + input_str->refcount.v = _UPB_STRING_REFCOUNT_STACK; + } return true; } static void cleanup() { + if (!BYREF) { + // Undo our fabrication from before. + input_str->refcount.v = 1; + } upb_string_unref(input_str); upb_msg_unref(msg, def); upb_def_unref(UPB_UPCAST(def)); |