<div dir="ltr"><a href="https://docs.google.com/document/d/1O1B7LY13L532kXcYcB2EdO65m5LOCsqaqn5R9iJfSPU/pub" target="_blank">https://docs.google.com/document/d/1O1B7LY13L532kXcYcB2EdO65m5LOCsqaqn5R9iJfSPU/pub</a><div><br></div><div>The optimized stack .o is 1248 bytes and the on the heap vector is 1600 bytes with gcc 4.8. The cost of either is pretty small. So, if there are 100 of these in gdal, we are talking about 30-60K of extra object file size for all the cases in GDAL.</div><div><br></div><div>For stack usage, start thinking about tons of threads spread out over lots of cores and think about how systems are built... Google Compute Engine has 32 core machines. If you want to get the most out your machines at scale, you want a small stack. <br></div><div><br></div><div><span style="font-size:12.8px">int anVals[256] = {}; Does initialize everything to the default value (zeros), but doesn't solve the stack issue.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Making a little class is yet another thing for people to learn when vector looks to me to work quite well.</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 9, 2016 at 1:37 PM, Andrew Bell <span dir="ltr"><<a href="mailto:andrew.bell.ia@gmail.com" target="_blank">andrew.bell.ia@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Mon, May 9, 2016 at 2:49 PM, Mateusz Loskot <span dir="ltr"><<a href="mailto:mateusz@loskot.net" target="_blank">mateusz@loskot.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Point taken.<br>
<br>
Although the proposal looks OK, I'd suggest to check what<br>
assembler code generates your favourite C++ toolkit,<br>
or at least measured times for<br>
<span><br>
int anVals[256];<br>
memset(anVals, 0, 256*sizeof(int));<br></span></blockquote><div><br></div></span><div>Are "we" doing memset anymore in these cases?</div><div><br></div><div>int anVals[256] = {};</div><div><br></div><div>seems preferable</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">vs<br>
<span><br>
std::vector<int> oVals(256, 0);<br>
<br>
</span>and compare with:<br>
<br>
std::vector<char> oVals(256, 0);<br></blockquote><div><br></div></span><div>Think vector is a bad solution for something that's fixed. Just write something. But I already suggested that and wrote something... :)</div><div><br></div><div>Do you know why they are wedded to a 16K stack?</div><span class="HOEnZb"><font color="#888888"><div><br></div></font></span></div><span class="HOEnZb"><font color="#888888">-- <br><div>Andrew Bell<br><a href="mailto:andrew.bell.ia@gmail.com" target="_blank">andrew.bell.ia@gmail.com</a></div>
</font></span></div></div>
<br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">--<div><a href="http://schwehr.org" target="_blank">http://schwehr.org</a></div></div>
</div>