Skip to content

Commit

Permalink
st.c: use ccan linked-list (try 2)
Browse files Browse the repository at this point in the history
This improves the bm_vm2_bighash benchmark significantly by
removing branches during insert, but slows down anything
requiring iteration with the more complex loop termination
checking.

Speedup ratio of 1.10 - 1.20 is typical for the vm2_bighash
benchmark.

* include/ruby/st.h (struct st_table): hide struct list_head
* st.c (struct st_table_entry): adjust struct
  (head, tail): remove shortcut macros
  (st_head): new wrapper function
  (st_init_table_with_size): adjust to new struct and API
  (st_clear): ditto
  (add_direct): ditto
  (unpack_entries): ditto
  (rehash): ditto
  (st_copy): ditto
  (remove_entry): ditto
  (st_shift): ditto
  (st_foreach_check): ditto
  (st_foreach): ditto
  (get_keys): ditto
  (get_values): ditto
  (st_values_check): ditto
  (st_reverse_foreach_check): ditto (unused)
  (st_reverse_foreach): ditto (unused)
  [ruby-core:69726] [Misc #10278]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
normal committed Jun 26, 2015
1 parent 08414a6 commit d3725a8
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 163 deletions.
23 changes: 23 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
Sat Jun 27 06:58:01 2015 Eric Wong <e@80x24.org>

* include/ruby/st.h (struct st_table): hide struct list_head
* st.c (struct st_table_entry): adjust struct
(head, tail): remove shortcut macros
(st_head): new wrapper function
(st_init_table_with_size): adjust to new struct and API
(st_clear): ditto
(add_direct): ditto
(unpack_entries): ditto
(rehash): ditto
(st_copy): ditto
(remove_entry): ditto
(st_shift): ditto
(st_foreach_check): ditto
(st_foreach): ditto
(get_keys): ditto
(get_values): ditto
(st_values_check): ditto
(st_reverse_foreach_check): ditto (unused)
(st_reverse_foreach): ditto (unused)
[ruby-core:69726] [Misc #10278]

Fri Jun 26 12:48:37 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>

* transcode.c (load_transcoder_entry): fix transcoder loading race
Expand Down
2 changes: 1 addition & 1 deletion include/ruby/st.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct st_table {
union {
struct {
struct st_table_entry **bins;
struct st_table_entry *head, *tail;
void *private_list_head[2];
} big;
struct {
struct st_packed_entry *entries;
Expand Down

0 comments on commit d3725a8

Please sign in to comment.