diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-02-14 07:44:35 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-02-14 07:44:35 -0800 |
commit | 2ab6f0183ba2fb014cc028aeb8afb6a2aba7c059 (patch) | |
tree | 37e1126e0ebfff351489ba63ee9cda8ef5e670b9 /struct.c | |
parent | ee7866ae60fe4357bbcd453dbfdf5a90528dda7b (diff) | |
download | txr-2ab6f0183ba2fb014cc028aeb8afb6a2aba7c059.tar.gz txr-2ab6f0183ba2fb014cc028aeb8afb6a2aba7c059.tar.bz2 txr-2ab6f0183ba2fb014cc028aeb8afb6a2aba7c059.zip |
Optimize hash operation with unsafe car/cdr.
The associative lists that make up the chains of a hash table
are guaranteed to be made of conses. We can use unsafe
versions of car, cdr, rplaca and rplacd to speed up hash
operations.
* eval.c (op_dohash): Use unsafe operations on hash cell.
* filter.c (trie_compress, regex_from_trie): Likewise.
* hash.c (hash_equal_op, hash_print_op, hash_mark, hash_grow,
hash_assoc, hash_assql, copy_hash_chain, gethash, inhash,
gethash_n, sethash, remhash, hash_next, maphash,
do_weak_tables, group_by, group_reduce, hash_keys_lazy,
hash_keys, hash_values_lazy, hash_values, hash_pairs_lazy,
hash_pairs, hash_alist_lazy, hash_uni, hash_diff,
hash_symdiff, hash_isec, hash_subset, hash_update,
hash_update_1, hash_revget): Likewise.
* lib.c (us_rplaca, us_rplacd): New functions.
(package_local_symbols, package_foreign_symbols, where,
populate_obj_hash, obj_hash_merge): Use unsafe operations on
hash cell
* lib.h (us_rplaca, us_rplacd): Declared.
* parser.c (circ_backpatch, get_visible_syms): Use unsafe
operations on hash cell.
* struct.c (method_name, get_slot_syms): Likewise.
Diffstat (limited to 'struct.c')
-rw-r--r-- | struct.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1550,8 +1550,8 @@ val method_name(val fun) val sth_cell; while ((sth_cell = hash_next(sth_iter))) { - val sym = car(sth_cell); - val stype = cdr(sth_cell); + val sym = us_car(sth_cell); + val stype = us_cdr(sth_cell); val sl_iter; struct struct_type *st = coerce(struct struct_type *, stype->co.handle); @@ -1596,7 +1596,7 @@ val get_slot_syms(val package, val is_current, val method_only) val sth_cell; while ((sth_cell = hash_next(sth_iter))) { - val stype = cdr(sth_cell); + val stype = us_cdr(sth_cell); val sl_iter; struct struct_type *st = coerce(struct struct_type *, stype->co.handle); |