revert change from strings/keys being presented as binaries to being presented as lists of characters. ~30% speedup

This commit is contained in:
alisdair sullivan 2011-07-31 19:05:30 -07:00
parent 20f9e0368d
commit b3eb058463
23 changed files with 57 additions and 57 deletions

View file

@ -357,11 +357,11 @@ key(Bin, Stack, Opts) ->
string(Bin, Stack, Opts) -> string(Bin, Stack, Opts, []).
string(<<?quote/?utfx, Rest/binary>>, [key|_] = Stack, Opts, Acc) ->
{jsx, {key, unicode:characters_to_binary(lists:reverse(Acc))}, fun() ->
{jsx, {key, lists:reverse(Acc)}, fun() ->
colon(Rest, Stack, Opts)
end};
string(<<?quote/?utfx, Rest/binary>>, Stack, Opts, Acc) ->
{jsx, {string, unicode:characters_to_binary(lists:reverse(Acc))}, fun() ->
{jsx, {string, lists:reverse(Acc)}, fun() ->
maybe_done(Rest, Stack, Opts)
end};
string(<<?rsolidus/?utfx, Rest/binary>>, Stack, Opts, Acc) ->
@ -1228,7 +1228,7 @@ check_bad(List) ->
).
check_replaced(List) ->
lists:dropwhile(fun({_, [{string, <<16#fffd/utf8>>}|_]}) ->
lists:dropwhile(fun({_, [{string, [16#fffd]}|_]}) ->
true
; (_) ->
false