authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-05-06 18:12:35+03:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2020-05-06 18:12:35+03:00
log9c422c28f62cdc5fc2e675318c58b1b3710f0778
tree6fa1538d7affbfcafbbbdec5e63a604b24c7d959
parent0e30edd8d099f005e3d1ee4de1d130c6e5c69295
parent3c4abacba67830f368f0d22de796a9b531044a15
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #5281 from data-man/hash_vector_nocopy

Optimization of vectors hashing

1 files changed, 1 insertions(+), 3 deletions(-)

lib/std/hash/auto_hash.zig+1-3
...@@ -113,11 +113,9 @@ pub fn hash(hasher: var, key: var, comptime strat: HashStrategy) void {...@@ -113,11 +113,9 @@ pub fn hash(hasher: var, key: var, comptime strat: HashStrategy) void {
113 hasher.update(mem.asBytes(&key));113 hasher.update(mem.asBytes(&key));
114 } else {114 } else {
115 // Otherwise, hash every element.115 // Otherwise, hash every element.
116 // TODO remove the copy to an array once field access is done.
117 const array: [info.len]info.child = key;
118 comptime var i = 0;116 comptime var i = 0;
119 inline while (i < info.len) : (i += 1) {117 inline while (i < info.len) : (i += 1) {
120 hash(hasher, array[i], strat);118 hash(hasher, key[i], strat);
121 }119 }
122 }120 }
123 },121 },