From:             alex-spam at rdc dot ru
Operating system: all
PHP version:      4.3.11
PHP Bug Type:     Feature/Change Request
Bug description:  FEATURE: Alternative to eval() to effectively optimize scripts

Description:
------------
From: Alex Fortuna

My proposal, if accepted and implemented, will allow for ever tougher
optimization of processing-intensive PHP scripts.

I think it would be great if, in addition to existing eval() function, a
pair of functions were implemented, like:

        int eval_prepare (string $code);
        bool eval_exec (int $handle);

eval_prepare() compiles a piece of code and stores it in engine's memory
under an integer handle. You call it once outside the processing loop.

eval_exec() executes the given handle's code. You call it INSIDE the
processing loop.

The reason is practical: sometimes the programmer KNOWS how to optimize a
piece of code, but he CAN'T, since certain parts of it are dynamic. For
example, actual string token values may differ from call to call, though
processing logic is always the same.

The possibility to separately compile and execute script-generated PHP
code will give programmers a unique chance to achieve ever greater script
performance, the demand for which is continuosly growing.

I've made some prototype performance benchmarks on a script which parses
syntax. The results were amazing: about 2 to 3 times performance increase
without extra script complexity.

If you need a working example, please write via e-mail.

Thank you for your time.

Best regards,
Alex


Reproduce code:
---------------
.

Expected result:
----------------
.

Actual result:
--------------
.

-- 
Edit bug report at http://bugs.php.net/?id=33418&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33418&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33418&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33418&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33418&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33418&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33418&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33418&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33418&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33418&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33418&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33418&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33418&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33418&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33418&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33418&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33418&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33418&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33418&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33418&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33418&r=mysqlcfg

Reply via email to