From 04a96b059faac8100a291e56bfbdb1962d53d4e1 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 6 Feb 2024 21:57:17 +1100 Subject: Use different hash algorithms for strings and file hashing For hash map, using fnv1a is faster as it is a much simpler algorithm we can afford to inline. For files murmur3 should win as it processes bytes 4 by 4. --- src/buffer_utils.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/buffer_utils.cc') diff --git a/src/buffer_utils.cc b/src/buffer_utils.cc index 21ec7092..be255e4a 100644 --- a/src/buffer_utils.cc +++ b/src/buffer_utils.cc @@ -140,7 +140,7 @@ decltype(auto) parse_file(StringView filename, Func&& func) const bool crlf = has_crlf and not has_lf; auto eolformat = crlf ? EolFormat::Crlf : EolFormat::Lf; - FsStatus fs_status{file.st.st_mtim, file.st.st_size, hash_data(file.data, file.st.st_size)}; + FsStatus fs_status{file.st.st_mtim, file.st.st_size, murmur3(file.data, file.st.st_size)}; return func(parse_lines(pos, end, eolformat), bom, eolformat, fs_status); } -- cgit v1.2.3