diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2013-11-18 12:49:25 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2013-11-18 12:49:25 -0800 |
commit | defe402b07d35f47ad33adefee69a06cbf2bc306 (patch) | |
tree | ee0f2155372d2de6248e447b08e4864254ff6892 /lib/ffi_yajl.rb | |
parent | 5cb62ae0c9dcb67f4fc08c4648835fe0a76395a1 (diff) | |
download | ffi-yajl-defe402b07d35f47ad33adefee69a06cbf2bc306.tar.gz |
fix major encoding perf bug
Diffstat (limited to 'lib/ffi_yajl.rb')
-rw-r--r-- | lib/ffi_yajl.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ffi_yajl.rb b/lib/ffi_yajl.rb index 233ebdd..5feb9b0 100644 --- a/lib/ffi_yajl.rb +++ b/lib/ffi_yajl.rb @@ -287,7 +287,10 @@ class Hash def ffi_yajl(yajl_gen, state) FFI_Yajl.yajl_gen_map_open(yajl_gen) self.each do |key, value| - key.ffi_yajl(yajl_gen, state.merge({:processing_key => true})) + # Perf Fix: mutate state hash rather than creating new copy + state[:processing_key] = true + key.ffi_yajl(yajl_gen, state) + state[:processing_key] = false value.ffi_yajl(yajl_gen, state) end FFI_Yajl.yajl_gen_map_close(yajl_gen) |