Re: PostgreSQL future ideas

From: Mark Mielke <mark(at)mark(dot)mielke(dot)cc>
To: Gevik Babakhani <pgdev(at)xs4all(dot)nl>
Cc: Zdenek(dot)Kotala(at)Sun(dot)COM, 'PGSQL Hackers' <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PostgreSQL future ideas
Date: 2008-09-25 15:10:44
Message-ID: 48DBA9F4.60502@mark.mielke.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Gevik Babakhani wrote:
>> 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++ :-).
>>
>
> 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.
>

Not sure what "reduce" means here. Is the following really a
*worthwhile* reduction?

Class* object = Class_new(...);
Class_method(object, ...);
Class_destroy(object);

Compared to:

Class *object = new Class(...);
object->method(...);
delete object;

Yes, this can sometimes be abbreviated by using stack-based objects:

Class object (...);
object.method(...);

Though, this limits capabilities in terms of automatic memory management
in terms of passing pointers to object around, or to using a memory area
that is cleaned up as a whole "in bulk" once it is no longer required.

STL can help, but it can also hinder.

I'm not convinced that a C++ PostgreSQL would be that much smaller
either in terms of source lines of code, or in terms of resulting binary
size. Also, it may not run faster. If the method calls are virtual, for
instance, and derived classes are used, each method call becomes one
more level of indirection.

>> Better idea is to start to use C99 in PostgreSQL ;-).
>>
>
> 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

The code might look a little bit cleaner, but other than that, I don't
see it running faster or being significantly smaller.

Cheers,
mark

--
Mark Mielke <mark(at)mielke(dot)cc>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Justin Yao 2008-09-25 15:21:43 Re: how can I find out the numeric directory name of each database in PostgreSQL 8.3
Previous Message Tom Lane 2008-09-25 15:02:45 Re: how can I find out the numeric directory name of each database in PostgreSQL 8.3

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Cave-Ayland 2008-09-25 15:21:32 Missing results from scroll cursor in PostgreSQL 8.3.3?
Previous Message Simon Riggs 2008-09-25 13:44:17 Re: Add default_val to pg_settings