Proof of Concept: code generation module

Hi,

I've been testing some code generation techniques for Drupal; I created a module that copies the code of your drupal installation to a temporary directory. First it splits all functions and class into seperate files. Then it modifies the function calls so that functions gets loaded when needed.

It will decrease memory usage a lot! Especially when a great number of modules are installed.

WARNING Please don't try this module on your production website; it'll probably destroy it!

To try the module:

  • Make sure you use Drupal 6
  • download and install dcc.module
  • Move index2.php from dcc directory to your drupal root
  • Goto Admin > Drupal Compiler > Build and run it
  • Call yoursite.com/index.php?q={path}
  • Or rename index.php to something else, and index2.php to index.php

    Note that this module is more of a proof of concept than an actual module! What do you think? Could be an alternative/addition to the registry in D7?

  • Login to post comments

    Split mode!

    Boris Mann's picture
    Boris Mann - Thu, 2009-06-04 16:40

    chx coded this in 2005 :P http://drupal.org/node/35657


    and stopped...

    greggles's picture
    greggles - Fri, 2009-06-05 12:36

    When he found opcode caching ;)

    These scripts only help if you don't use opcode cache. If you are worried about performance, use an opcode cache.

    --
    Growing Venture Solutions | Drupal Dashboard | Learn more about Drupal - buy a Drupal Book


    Well I don't think so: I

    casey - Fri, 2009-06-05 12:57

    Well I don't think so: I always use eaccelerator.

    I tested my module with 20+ modules (views, cck, panels, etc). average memory usage: 12 - 17 MB per request.

    With dcc.module it is somewhere between 5 - 12 MB.

    And secondly, registry in D7 has same purpose: not to load unnecessary code. This module does the same without extra database queries.