<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Nov 15, 2018, at 8:11 AM, Sandro Santilli <<a href="mailto:strk@kbt.io" class="">strk@kbt.io</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">On Thu, Nov 15, 2018 at 04:26:56PM +0100, Hugo Mercier wrote:<br class=""><blockquote type="cite" class=""><br class=""><br class="">On 15/11/2018 11:55, Sandro Santilli wrote:<br class=""><br class=""><blockquote type="cite" class=""><br class="">I was asking just because I'm pretty sure we need more flagspace<br class="">for introducing validity. And we need NOT to consume all flags,<br class="">so that we can use the last available flag for specifying there<br class="">are more flags following it.<br class=""><br class=""></blockquote><br class="">Are you suggesting a variable-length flags in postgis 3.0 header ?<br class="">Each flag byte would have one bit that says "wait there is more" ?<br class=""></blockquote><br class="">Yes, also known as the "extension bit”</div></div></blockquote><div><br class=""></div><div>So, this might be something we no longer care about, but the serialization we have was designed to land the double arrays on alignment boundaries, so it’s possible to directly read the values without copying them out into aligned storage. This may or may not have been a “big win”, since intel architectures allow unaligned reads (with a slight performance penalty) and most of our architectures are intel, but some architectures like RISC do not allow unaligned reads, so copying is required.</div><div><br class=""></div><div>For large objects that end up compressed this is all kind of moot, and if we go to an internal compression scheme in gserialized3 then there’s a copy step anyways and the coordinate destination can be an aligned array. For small objects it’s possible we’ve been getting a win maintaining alignment.</div><div><br class=""></div><div>All this to say, optional header components almost *have* to add 8 bytes to a stored object, so we’d want to ensure that any flags going there are relatively rare or special case, not common. Or, we go back to copy-on-deserialize everywhere, as in PostGIS 1.x, and have a slimmer, more optionalized, serialization. With the use of expanded object headers in PgSQL, the overhead of copy-on-deserialize can be reduced in function(chaining(cases())) but the one-function-call overhead of it will be unavoidable.</div><div><br class=""></div><div>I am interested in doing a new serialization but there are many things to balance and a lot of decisions that we should probably actually *measure* this time, as past decisions made in the “gut” (for example, using main storage over extended) have turned out to be counter-intuitively wrong. </div><div><br class=""></div><div>So, I’m happy to have this conversation, but I don’t want people to lift up their tools and start hacking next week… how about we start by writing out some proposals in text documents? See for example the old <a href="https://github.com/postgis/postgis/blob/svn-trunk/liblwgeom/g_serialized.txt" class="">https://github.com/postgis/postgis/blob/svn-trunk/liblwgeom/g_serialized.txt</a></div><div><br class=""></div><div>P</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">--strk;<br class="">_______________________________________________<br class="">postgis-devel mailing list<br class=""><a href="mailto:postgis-devel@lists.osgeo.org" class="">postgis-devel@lists.osgeo.org</a><br class="">https://lists.osgeo.org/mailman/listinfo/postgis-devel</div></div></blockquote></div><br class=""></body></html>