← Back to team overview

kicad-developers team mailing list archive

Re: Strokefont change from std::deque to std::vector

 

On 12/2/19 3:45 PM, Jeff Young wrote:
Hi Seth,

What was the reason for the change from std::deque to std::vector?  Building the stroke font is now accounting for 50% of document load time (I /think/ because we’re using a 2D vector so that any resize of any constituent vector has to reallocate the whole shebang).

We also load the font twice, which is something I’ll look at fixing irrespective of the above.

Thanks,
Jeff.



Hmm... That's true.  As we are allocating, we don't have pre-knowledge of the Hershey point list lengths, so the vectors get resized as we add.  How much will depend a bit on implementation. But we'll gain speed by cycling once over the font and building our length knowledge first.

The vector change was due to the deque overhead.  A deque takes a fair amount of memory for the structure.  We generate a bunch of vectors with only 3-4 elements and the size of the deque is dominated by the structure overhead.  There was so much that JP's machine was crashing with the extra CJK fonts.

Best-
Seth

--
KiCad Services Corporation KiCad Services Corporation Logo
Seth Hillbrand
*Lead Developer*
+1-530-302-5483‬ <tel:+12126039372>
Davis, CA
www.kipro-pcb.com <https://www.kipro-pcb.com/> info@xxxxxxxxxxxxx <mailto:info@xxxxxxxxxxxxx> https://twitter.com/KiProEDA <https://twitter.com/KiProEDA> https://www.linkedin.com/company/kicad <https://www.linkedin.com/company/kicad>


Follow ups

References