Skip to content

Commit

Permalink
Merge pull request #622 from byroot/hash-key-speedup
Browse files Browse the repository at this point in the history
Speedup Parser initialization
  • Loading branch information
byroot authored Oct 17, 2024
2 parents abcfbc0 + 43835a0 commit 54b5f2b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions ext/json/ext/parser/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static VALUE CNaN, CInfinity, CMinusInfinity;

static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
i_chr, i_max_nesting, i_allow_nan, i_symbolize_names,
i_object_class, i_array_class, i_decimal_class, i_key_p,
i_object_class, i_array_class, i_decimal_class,
i_deep_const_get, i_match, i_match_string, i_aset, i_aref,
i_leftshift, i_new, i_try_convert, i_freeze, i_uminus;

Expand Down Expand Up @@ -2180,7 +2180,6 @@ void Init_parser(void)
i_decimal_class = rb_intern("decimal_class");
i_match = rb_intern("match");
i_match_string = rb_intern("match_string");
i_key_p = rb_intern("key?");
i_deep_const_get = rb_intern("deep_const_get");
i_aset = rb_intern("[]=");
i_aref = rb_intern("[]");
Expand Down
2 changes: 1 addition & 1 deletion ext/json/ext/parser/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# define MAYBE_UNUSED(x) x
#endif

#define option_given_p(opts, key) RTEST(rb_funcall(opts, i_key_p, 1, key))
#define option_given_p(opts, key) (rb_hash_lookup2(opts, key, Qundef) != Qundef)

typedef struct JSON_ParserStruct {
VALUE Vsource;
Expand Down
3 changes: 1 addition & 2 deletions ext/json/ext/parser/parser.rl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static VALUE CNaN, CInfinity, CMinusInfinity;

static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
i_chr, i_max_nesting, i_allow_nan, i_symbolize_names,
i_object_class, i_array_class, i_decimal_class, i_key_p,
i_object_class, i_array_class, i_decimal_class,
i_deep_const_get, i_match, i_match_string, i_aset, i_aref,
i_leftshift, i_new, i_try_convert, i_freeze, i_uminus;

Expand Down Expand Up @@ -940,7 +940,6 @@ void Init_parser(void)
i_decimal_class = rb_intern("decimal_class");
i_match = rb_intern("match");
i_match_string = rb_intern("match_string");
i_key_p = rb_intern("key?");
i_deep_const_get = rb_intern("deep_const_get");
i_aset = rb_intern("[]=");
i_aref = rb_intern("[]");
Expand Down

0 comments on commit 54b5f2b

Please sign in to comment.