← Back to team overview

kicad-developers team mailing list archive

[PATCH] Increase initial vertex container size by order of magnitude

 

Next in the series of OpenGL performance work related to this bug:
https://bugs.launchpad.net/kicad/+bug/1745203

In the scenario of this bug report (load lots of gerber files, each with
lots of items) we struggle with vertex allocation.
On my Linux system with NVIDIA GPU, the attached patch speeds up
load/display of the file (and showing of Dcodes) by 50%.

This patch feels kind of like a hack; and I'm not sure if it would cause
any issues on low-spec systems.
I'm curious for input from Orson/Tom and anyone else who has looked at our
OpenGL system.

But, if it is safe, it could be a nice one-line speed improvement for
scenarios where we throw tons of items at the OpenGL GAL.

Maybe a longer-term fix would be to take a look at the vertex container
algorithms and see if we can be more intelligent about when and how much we
allocate memory to reduce this overhead without having such a huge initial
size.

-Jon
From 35176de47a9f9b01f19dcde3927d0f1e47e11141 Mon Sep 17 00:00:00 2001
From: Jon Evans <jon@xxxxxxxxxxxxx>
Date: Wed, 31 Jan 2018 22:25:06 -0500
Subject: [PATCH] Increase initial vertex container size by order of magnitude

---
 include/gal/opengl/vertex_container.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/gal/opengl/vertex_container.h b/include/gal/opengl/vertex_container.h
index ac4b9b6ae..7909dff38 100644
--- a/include/gal/opengl/vertex_container.h
+++ b/include/gal/opengl/vertex_container.h
@@ -177,7 +177,7 @@ protected:
     }
 
     ///< Default initial size of a container (expressed in vertices)
-    static constexpr unsigned int DEFAULT_SIZE = 1048576;
+    static constexpr unsigned int DEFAULT_SIZE = 10485760;
 };
 } // namespace KIGFX
 
-- 
2.14.1


Follow ups