Re: PostgreSQL future ideas
От | Mark Mielke |
---|---|
Тема | Re: PostgreSQL future ideas |
Дата | |
Msg-id | 48DBA9F4.60502@mark.mielke.cc обсуждение исходный текст |
Ответ на | Re: PostgreSQL future ideas ("Gevik Babakhani" <pgdev@xs4all.nl>) |
Список | pgsql-hackers |
Gevik Babakhani wrote: <blockquote cite="mid:002401c91ef4$16302fc0$0a01a8c0@gevmus" type="cite"><blockquote type="cite"><prewrap="">Advantage of C++ is that it reduce lot of OO code written in C in PostgreSQL, but it is so big effort to do that without small gain. It will increase number of bugs. Do not forget also that C++ compiler is not so common (so good) on different platforms. If somebody interesting in that yes but like a fork ( PostgreSQL++ :-). </pre></blockquote><pre wrap=""> Reducing OO code that is written in C is one of my major interests. After some investigating myself it appears that having the codebase fully (rewritten in C++ will have an impact on the performance. So I guess such an effort will result the code being more C++ish and fully OO, being a mixture in C with some OO taste. </pre></blockquote><br /> Not sure what "reduce" means here. Is the following really a *worthwhile*reduction?<br /><br /> Class* object = Class_new(...);<br /> Class_method(object, ...);<br /> Class_destroy(object);<br/><br /> Compared to:<br /><br /> Class *object = new Class(...);<br /> object->method(...);<br/> delete object;<br /><br /> Yes, this can sometimes be abbreviated by using stack-based objects:<br/><br /> Class object (...);<br /> object.method(...);<br /><br /> Though, this limits capabilities interms of automatic memory management in terms of passing pointers to object around, or to using a memory area that is cleanedup as a whole "in bulk" once it is no longer required.<br /><br /> STL can help, but it can also hinder.<br /><br/> I'm not convinced that a C++ PostgreSQL would be that much smaller either in terms of source lines of code, or interms of resulting binary size. Also, it may not run faster. If the method calls are virtual, for instance, and derivedclasses are used, each method call becomes one more level of indirection.<br /><br /><blockquote cite="mid:002401c91ef4$16302fc0$0a01a8c0@gevmus"type="cite"><pre wrap=""></pre><blockquote type="cite"><pre wrap="">Betteridea is to start to use C99 in PostgreSQL ;-). </pre></blockquote><pre wrap=""> I have not investigated this yet. But I am very interested to know what the advantages would be to "upgrade" the code to C99 standards</pre></blockquote><br /> The code might look a little bit cleaner,but other than that, I don't see it running faster or being significantly smaller.<br /><br /> Cheers,<br /> mark<br/><br /><pre class="moz-signature" cols="72">-- Mark Mielke <a class="moz-txt-link-rfc2396E" href="mailto:mark@mielke.cc"><mark@mielke.cc></a> </pre>
В списке pgsql-hackers по дате отправления: