At the expense of inciting a stir, I would like to propose a radically different way of tackling performance issues that drupal allegedly suffers from. Performance of drupal based sites could be increased by migrating some of the PHP core to C++. Combined with mysql++ there is a case for this migration, measuring from the language shootout. Most PHP programmers have at least some command of C++. Granted, this migration initiative will not be the only performance tuning measure possible. Database tuning, page caching and terse programming style are only some of the measures that should still be taken. Furthermore, C++ based content management systems are hard to find; well-maintained ones are even non-existent and probably for good reasons. A disadvantage that I see is there will be too few developers to maintain the core, leading to increasingly contrived programming practices in order to accommodate the next new feature, and in the worst case leading to a PHP fork and a C++ fork.

Would like to hear someone's views on this.

Comments

styro’s picture

That would be a lot of work, for very little gain.

Disadvantages:

  • alienating most core contributors
  • slowing down development by a large factor
  • making it practically impossible to install Drupal on shared hosting
  • much more support and testing would be required: either the Drupal project will need to provide precompiled binaries for lots of platform/web server combos, or require users to compile their own binaries
  • opening up whole new classes of bugs and vulnerabilities to avoid
  • making cross platform and cross web server support harder

Realistically, any C++ code would still need to be duplicated by a PHP option to allow Drupal to be run by less technical users or those on shared hosting.

In terms of very little gain, PHP number crunching is very rarely the bottleneck especially when APC or eaccellerator etc are being used. A C++ Drupal will still be held up by database queries and the overhead of opening module files etc. The larger a Drupal site gets, the more the database becomes the bottleneck.

Java would be a better choice than C++ in that it wouldn't have as many disadvantages - no buffer overruns, cross platform support, more core developer experience etc. But Java still wouldn't happen either (advantages wouldn't outweigh disadvantages) - rewriting Drupal in language X is one of those recurring April Fools posts.

--
Anton
New to Drupal? | Troubleshooting FAQ
Example knowledge base built with Drupal

misty3’s picture

I am being an September Fool :D

There was no drupal when php came. Does any one dream of a new language which can accomodate all drupal features to run smoothly on an average shared platform with plenty of concurrent users and nodes without any resource hogging issues ? Maybe in next 20,30, 50 ...100 years ?

No body in 1950 thought a gazzet the size of a notebook could handle so much of data processing ...
no body thought but probably the the dream and discussions were there :)

figaro’s picture

For the record, this has already been done elsewhere as I accidentally noticed : the core of MidGard is developed in C, which provides on average an even greater performance advantage than C++: http://www.midgard-project.org/midgard/1.8/