summaryrefslogtreecommitdiff
path: root/src/hash_map.hh
AgeCommit message (Collapse)Author
2025-06-26Delay destruction of item in hash map without returning an optionalMaxime Coste
Returning an optional of the removed item is not very idiomatic and we currently have no use case for this.
2025-06-26Fix crash on redraw in BufCloseFifo hookJohannes Altmanninger
FifoWatcher::read_fifo() deletes the fifo watcher in m_buffer.values().erase(fifo_watcher_id); // will delete this which calls: HashMap::unordered_remove() constexpr_swap(m_items[index], m_items.back()); destructor called here --> m_items.pop_back(); m_index.remove(hash, index); So hash map invariants (of buffer.values()) are broken, when calling ~FifoWatcher which fires BufCloseFifo hooks. Things blow up if those hooks access buffer.values() such as by accessing cached highlighters to redraw the buffer. A shell call with a long sleep in the client context seems to trigger this. Fix this by destroying removed map items only at the end of HashMap::remove(), when invariants are restored. Alternatively, we could introduce a fifo_trash container; I haven't explored that.
2024-06-23Fix trailing whitespacesMaxime Coste
2024-02-28compare against 0 instead of -1 in hash map codeMaxime Coste
2023-11-18Fix use after move in HashMap::insertJohannes Altmanninger
Apparently GCC builds worked fine but Clang builds started failing the "(hash == hash_value(item_key(item)))" assertion.
2023-11-17Improve WordDB performance by precomputing hashesMaxime Coste
Avoid multiple computation of string hashes by making it possible to pre-compute and pass hashes to interned strings and hash maps.
2023-10-25Remove redundant comparison operatorsMaxime Coste
Since C++20 (a != b) get automatically rewritten as !(a == b) if the != operator does not exist.
2023-05-29Refactor KeymapManager to enfore setting is_executing on key iterationMaxime Coste
Add an iterator based remove to HashMap as that was missing. Make KeymapManager responsible for throwing on unmap an executing mapping.
2022-08-20Refactor RegionsHighlighter to share regexesMaxime Coste
Instead of storing regexes in each regions, move them to the core highlighter in a hash map so that shared regexes between different regions are only applied once per update instead of once per region Also change iteration logic to apply all regex together to each changed lines to improve memory locality on big buffers. For the big_markdown.md file described in #4685 this reduces initial display time from 3.55s to 2.41s on my machine.
2022-08-05Add HashSet implemented as HashMap with void value typeMaxime Coste
2022-08-05Change HashMap not to support multiple identical keys by defaultMaxime Coste
We do not seem to have any uses for this remaining, and this is better opt-in with MultiHashMap
2021-11-21Replace std::enable_if with requiresMaxime Coste
Introduce some concepts for enum and flags handling, goodbye and thanks for all the fish std::enable_if.
2020-07-19Code style tweaksMaxime Coste
2018-07-05Add HashMap::items to access item listMaxime Coste
2018-04-05Fix some trailing spaces and a tab that sneaked into the code baseMaxime Coste
2017-11-01Fix ConstexprVector::resizeMaxime Coste
2017-10-27HashMap: Tolerate reserving for 0 elementsMaxime Coste
Fixes #1652
2017-10-20Make the normal mode keymap a compile time hash mapMaxime Coste
This hash map is now fully constexpr, and ends up stored in the read only data segment instead of being recomputed at each startup.
2017-08-18Revert "Change HashCompatible trait to a variable template"Maxime Coste
This reverts commit b58f72315cbf7ee8921659dd129fd2f6a221bcfc. Unfortunately gcc-5.1 handling of variable template partial specializations is bugged.
2017-08-14Change HashCompatible trait to a variable templateMaxime Coste
2017-07-19More uses of standard type traits aliasesMaxime Coste
2017-03-07Try to please clang-3.5Maxime Coste
2017-03-07Cleanup hash_map codeMaxime Coste
2017-03-07Expand a bit the hash map profiling codeMaxime Coste
2017-03-07Remove temporary stats code from HashMapMaxime Coste
2017-03-07Replace IdMap with HashMapMaxime Coste
2017-03-07Replace uses of UnorderedMap with HashMapMaxime Coste
2017-03-06Introduce a custom HashMap implementation along with a quick benchmarkMaxime Coste