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

Jean-Marc Lasgouttes lasgouttes at lyx.org
Tue Oct 5 15:30:27 UTC 2021


The branch, breakrows, has been updated.

- Log -----------------------------------------------------------------

commit aa3f55a4e31f2631e8c77d10a5479979c05e7b89
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 large text insets.
    
    Related to bug #12297.

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index bff44cd..523774b 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_;
 };
 

-----------------------------------------------------------------------

Summary of changes:
 src/BufferView.cpp |    2 +-
 src/CoordCache.h   |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
Repository for new features


More information about the lyx-cvs mailing list