diff options
| author | Maxime Coste <mawww@kakoune.org> | 2022-08-10 20:58:31 +0100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2022-08-20 11:02:59 +0200 |
| commit | c8c8051bd0341e3c9df933ee7c942d227ae13f00 (patch) | |
| tree | bd699460bb28bac5234789e0b282032eb54c957c /src/regex_impl.hh | |
| parent | ca71d8997d6144fd7bc770ff458d469a989d576c (diff) | |
Refactor RegionsHighlighter to share regexes
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.
Diffstat (limited to 'src/regex_impl.hh')
| -rw-r--r-- | src/regex_impl.hh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/regex_impl.hh b/src/regex_impl.hh index 73d69790..b0ceeecf 100644 --- a/src/regex_impl.hh +++ b/src/regex_impl.hh @@ -209,6 +209,8 @@ public: (not forward and program.first_backward_inst != -1)); } + ThreadedRegexVM(ThreadedRegexVM&&) = default; + ThreadedRegexVM& operator=(ThreadedRegexVM&&) = default; ThreadedRegexVM(const ThreadedRegexVM&) = delete; ThreadedRegexVM& operator=(const ThreadedRegexVM&) = delete; @@ -617,6 +619,11 @@ private: { DualThreadStack() = default; DualThreadStack(const DualThreadStack&) = delete; + DualThreadStack(DualThreadStack&& other) + : m_data{other.m_data}, m_capacity{other.m_capacity}, m_current{other.m_current}, m_next{other.m_next} + { + other.m_data = nullptr; + } ~DualThreadStack() { delete[] m_data; } bool current_is_empty() const { return m_current == 0; } |
