[LyX/master] Use unordered maps to store inset and math rows geometry.

Jean-Marc Lasgouttes lasgouttes at lyx.org
Fri Oct 8 15:56:48 UTC 2021


commit e09158efee92c6a57f5228af35f1cf8e0eeb07d8
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Tue Oct 5 16:58:49 2021 +0200

    Use unordered maps to store inset and math rows geometry.
    
    Simply using unordered_map instead of map makes a big difference for
    documents with lots of math insets in one text inset.
    
    Related to bug #12297.
---
 src/BufferView.cpp |    2 +-
 src/CoordCache.h   |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 526cb33..0f36dca 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -228,7 +228,7 @@ struct BufferView::Private
 	///
 	CoordCache coord_cache_;
 	///
-	typedef map<MathData const *, MathRow> MathRows;
+	typedef unordered_map<MathData const *, MathRow> MathRows;
 	MathRows math_rows_;
 
 	/// this is used to handle XSelection events in the right manner.
diff --git a/src/CoordCache.h b/src/CoordCache.h
index d1c0fa3..2780fc3 100644
--- a/src/CoordCache.h
+++ b/src/CoordCache.h
@@ -16,7 +16,7 @@
 
 #include "Dimension.h"
 
-#include <map>
+#include <unordered_map>
 
 namespace lyx {
 
@@ -153,7 +153,7 @@ private:
 			lyxbreaker(thing, hint, data_.size());
 	}
 
-	typedef std::map<T const *, Geometry> cache_type;
+	typedef std::unordered_map<T const *, Geometry> cache_type;
 	cache_type data_;
 };
 


More information about the lyx-cvs mailing list