rfc:error-optimizations

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:error-optimizations [2010/08/23 20:22] kallerfc:error-optimizations [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 3: Line 3:
   * Date: 2010-08-21   * Date: 2010-08-21
   * Author: Kalle Sommer Nielsen <kalle@php.net>   * Author: Kalle Sommer Nielsen <kalle@php.net>
-  * Status: In the works+  * Status: Draft (Inactive)
   * First Published at: http://wiki.php.net/rfc/error-optimizations   * First Published at: http://wiki.php.net/rfc/error-optimizations
  
Line 22: Line 22:
         zend_error_arguments error_stack[];         zend_error_arguments error_stack[];
         int error_stack_size: 0;         int error_stack_size: 0;
 +        ...
 </code> </code>
  
Line 59: Line 60:
         } else {         } else {
                   /* no logging, increase the stack size */                   /* no logging, increase the stack size */
 +
                   ++EG(error_stack_size);                   ++EG(error_stack_size);
         }         }
Line 72: Line 74:
 <code c> <code c>
 if (EG(error_stack_enabled) && EG(error_stack_size)) { if (EG(error_stack_enabled) && EG(error_stack_size)) {
-        char *error;+        char *error = (char *) emalloc(sizeof(zend_error_arguments)); 
 +        int error_length;
  
         /* dispatch to formatting function, and copy it into, the "error" variable */         /* dispatch to formatting function, and copy it into, the "error" variable */
 +        /* NOTE: This is just a pseudo function name for formatting */
 +        zend_format_error_arguments(&error, &error_length, EG(error_stack)[EG(error_stack_size)]);
  
-        RETURN_STRING(error, 0, 1);+        RETURN_STRINGL(error, error_length, 0, 1);
 } else { } else {
         /* BC code */         /* BC code */
 } }
 </code> </code>
 +
 +==== $php_errormsg ====
 +
 +This one is a tricky one, as we do not have any hooks for altering variables at reading, nor do we have JIT assignments. I think the best solution here is to simply remove $php_errormsg and require userland to use error_get_last() if they *REALLY* want the last errors, without depending on the track_errors ini options to be on.
 +
 +If its not removed, then we cannot gain any optimization with track_errors = On at all, so if thats the case, it has to be taken into account when initializing the error_stack executor globals.
  
 ==== Memory usage ==== ==== Memory usage ====
Line 86: Line 97:
 Obvious the memory usage here can grow quite rapidly, but people who would use this feature already takes great care of their code to not assume the opposite. Obvious the memory usage here can grow quite rapidly, but people who would use this feature already takes great care of their code to not assume the opposite.
  
-===== Notes =====+==== ZTS performance ====
  
-  * This is a very early WIP, the idea may changeor render obsolete in the future+Since the error stack is hooked into the executor globalswhich requires tsrm_ls to be available in thread safety mode, to avoid a call to TSRMLS_FETCH() everytime we hit the error callbacks or functions (zend_error, zend_error_cb, ...) then we should alter all references to include TSRMLS_DC/TSRMLS_CC for additional performance with ZTS.
rfc/error-optimizations.1282594974.txt.gz · Last modified: 2017/09/22 13:28 (external edit)