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 /eval.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 'eval.c')
-rw-r--r-- | eval.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -2498,8 +2498,8 @@ static val op_dohash(val form, val env) and also deleting them such that these variables end up with the only reference. But in that case, those objects will be noted in the GC's check list. */ - deref(cdr_l(keyvar)) = car(cell); - deref(cdr_l(valvar)) = cdr(cell); + *us_cdr_p(keyvar) = us_car(cell); + *us_cdr_p(valvar) = us_cdr(cell); eval_progn(body, new_env, form); } |