aboutsummaryrefslogtreecommitdiff
path: root/lib/std/hash
AgeCommit message (Collapse)Author
2022-08-22stage2+stage1: remove type parameter from bit builtinsVeikka Tuominen
Closes #12529 Closes #12511 Closes #6835
2022-08-14Fix #12423: auto_hash not hashing arrays of slices uniquelyYujiri
2022-08-11fix error message when providing slice to `std.hash.autoHash`LordMZTE
2022-07-20disable std lib test failing with self-hosted ReleaseSafeAndrew Kelley
I opened a corresponding issue #12178 which has the 0.10.0 milestone, so this must be fixed before we release.
2022-04-24std: fix crypto and hash benchmarkjagt
2022-03-08deprecated TypeInfo in favor of TypeJonathan Marler
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-01-31std: make ArrayHashMap eql function accept an additional paramAndrew Kelley
which is the index of the key that already exists in the hash map. This enables the use case of using `AutoArrayHashMap(void, void)` which may seem surprising at first, but is actually pretty handy! This commit includes a proof-of-concept of how I want to use it, with a new InternArena abstraction for stage2 that provides a compact way to store values (and types) in an "internment arena", thus making types stored exactly once (per arena), representable with a single u32 as a reference to a type within an InternArena, and comparable with a simple u32 integer comparison. If both types are in the same InternArena, you can check if they are equal by seeing if their index is the same. What's neat about `AutoArrayHashMap(void, void)` is that it allows us to look up the indexes by key, *without actually storing the keys*. Instead, keys are treated as ephemeral values that are constructed as needed. As a result, we have an extremely efficient encoding of types and values, represented only by three arrays, which has no pointers, and can therefore be serialized and deserialized by a single writev/readv call. The `map` field is denormalized data and can be computed from the other two fields. This is in contrast to our current Type/Value system which makes extensive use of pointers. The test at the bottom of InternArena.zig passes in this commit.
2021-11-30allocgate: renamed getAllocator function to allocatorLee Cannon
2021-11-30allocgate: std Allocator interface refactorLee Cannon
2021-11-30std lib API deprecations for the upcoming 0.9.0 releaseAndrew Kelley
See #3811
2021-10-27std.rand: Refactor `Random` interfaceOminitay
These changes have been made to resolve issue #10037. The `Random` interface was implemented in such a way that causes significant slowdown when calling the `fill` function of the rng used. The `Random` interface is no longer stored in a field of the rng, and is instead returned by the child function `random()` of the rng. This avoids the performance issues caused by the interface.
2021-10-04migrate from `std.Target.current` to `@import("builtin").target`Andrew Kelley
closes #9388 closes #9321
2021-09-30Merge remote-tracking branch 'origin/master' into llvm13Andrew Kelley
2021-09-19Update `hash` & `crypto` benchmarks run comment (#9790)Ali Chraghi
* sync function arguments name with other same functions
2021-09-01re-enable mips behavior tests for vectorsAndrew Kelley
closes #3317
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
2021-07-21Correct hasUniqueRepresentation for vectorsTau
Closes #9333.
2021-06-21fix code broken from previous commitJacob G-W
2021-06-21std, src, doc, test: remove unused variablesJacob G-W
2021-06-14CLI: rename --override-lib-dir to --zig-lib-dirAndrew Kelley
This breaking change disambiguates between overriding the lib dir when performing an installation with the Zig Build System, and overriding the lib dir that the Zig installation itself uses.
2021-06-14std: fix auto hash of tagged union with void fieldIsaac Freund
2021-05-20Run `zig fmt` on src/ and lib/std/Isaac Freund
This replaces callconv(.Inline) with the more idiomatic inline keyword.
2021-05-17std: update regarding std.builtin reorganizationAndrew Kelley
There are also some regressed std.fmt tests here and I haven't figured out what's wrong yet.
2021-05-08Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgenAndrew Kelley
Conflicts: * doc/langref.html.in * lib/std/enums.zig * lib/std/fmt.zig * lib/std/hash/auto_hash.zig * lib/std/math.zig * lib/std/mem.zig * lib/std/meta.zig * test/behavior/alignof.zig * test/behavior/bitcast.zig * test/behavior/bugs/1421.zig * test/behavior/cast.zig * test/behavior/ptrcast.zig * test/behavior/type_info.zig * test/behavior/vector.zig Master branch added `try` to a bunch of testing function calls, and some lines also had changed how to refer to the native architecture and other `@import("builtin")` stuff.
2021-05-08std: update usage of std.testingVeikka Tuominen
2021-04-28std: remove redundant comptime keywordAndrew Kelley
@g-w1's fancy new compile error in action
2021-04-15std: change `@import("builtin")` to `std.builtin`Andrew Kelley
2021-03-21Specify type in autoHash error messageJoris Hartog
This commit simply specifies the type which `autoHash` can't hash in the compile error. Closes #7970.
2021-02-10Convert inline fn to callconv(.Inline) everywhereTadeo Kondrak
2021-01-30Replace @TagType uses, mostly with std.meta.TagTadeo Kondrak
2021-01-11std CityHash: disable memory-expensive tests for nowAndrew Kelley
2021-01-11Modify cityhash to work at comptimeMartin Wickham
2021-01-02std: disable a couple tests on windowsAndrew Kelley
They are passing but we're hitting OOM on the Windows CI server. This is to buy us more time until stage2 rescues us from the CI memory crisis.
2020-12-31Year++Frank Denis
2020-12-26Handle unions in autoHashJulius Putra Tanu Setiaji
2020-12-26Also check whether structs contain slicesJulius Putra Tanu Setiaji
2020-12-17std: Don't hash undefined bitsLemonBoy
auto_hash must be extra careful when hashing integers whose bit size is not a multiple of 8 as, when reinterpreted with mem.asBytes, may contain undefined non-zero bits too.
2020-11-18Change seed for Murmur2_64 from u32 to u64breakin
2020-10-17Make std.meta.Int accept a signedness parameterJan Prudil
2020-09-14Merge pull request #6172 from tadeokondrak/@Type(.Union)Veikka Tuominen
Implement @Type for Union
2020-09-13std: Make the CRC32 calculation slightly fasterLemonBoy
Speed up a little the slicing-by-8 code path by replacing the (load+shift+xor)*4 sequence with a single u32 load plus a xor. Before: ``` iterative: 1018 MiB/s [000000006c3b110d] small keys: 1075 MiB/s [0035bf3dcac00000] ``` After: ``` iterative: 1114 MiB/s [000000006c3b110d] small keys: 1324 MiB/s [0035bf3dcac00000] ```
2020-09-07Use less inefficient method of replacing TypeInfo.UnionField.enum_fieldTadeo Kondrak
2020-09-07Update standard library for removal of TypeInfo.UnionField.enum_fieldTadeo Kondrak
2020-09-03update uses of deprecated type field accessVexu
2020-08-22Promote hash/siphash to crypto/siphashFrank Denis
SipHash *is* a cryptographic function, with a 128-bit security level. However, it is not a regular hash function: a secret key is required, and knowledge of that key allows collisions to be quickly computed offline. SipHash is therefore more suitable to be used as a MAC. The same API as other MACs was implemented in addition to functions directly returning an integer. The benchmarks have been updated accordingly. No changes to the SipHash implementation itself.
2020-08-20add license header to all std lib filesAndrew Kelley
add SPDX license identifier copyright ownership is zig contributors
2020-08-13translate-c: add return if one is neededVexu
2020-07-26make use of hasUniqueRepresentation to speed up hashing facilities, fastpath ↵Sahnvour
in getAutoHashFn is particularly important for hashmap performance gives a 1.18x speedup on gotta-go-fast hashmap bench
2020-07-26improve autoHash type switchSahnvour
floats shouldn't be autoHash'd as they have multiple representations for some values, preventing it by default is safer
2020-07-11run zig fmt on std lib and self hostedVexu