cvs: Zend(PHP_4_3) / zend_execute.c
| From: | Ilia Alshanetsky | Date: | Mon, 02 Aug 2004 02:35:05 +0000 |
| Subject: | cvs: Zend(PHP_4_3) / zend_execute.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-2833@lists.php.net to get a copy of this message | ||
iliaa Sun Aug 1 22:35:05 2004 EDT
Modified files: (Branch: PHP_4_3)
/Zend zend_execute.c
Log:
MFH: A gentler (performance wise) allocation of buffer for temp variables.
http://cvs.php.net/diff.php/Zend/zend_execute.c?r1=1.316.2.38&r2=1.316.2.39&ty=u
Index: Zend/zend_execute.c
diff -u Zend/zend_execute.c:1.316.2.38 Zend/zend_execute.c:1.316.2.39
--- Zend/zend_execute.c:1.316.2.38 Mon Jul 12 13:47:32 2004
+++ Zend/zend_execute.c Sun Aug 1 22:35:05 2004
@@ -53,6 +53,7 @@
/* These globals don't have to be thread safe since they're never modified */
+#define TEMP_VAR_STACK_LIMIT 2000
/* Prototypes */
static zval get_overloaded_property(temp_variable *T TSRMLS_DC);
@@ -1038,7 +1039,11 @@
EX(ce) = NULL;
EX(object).ptr = NULL;
EX(op_array) = op_array;
- EX(Ts) = (temp_variable *) safe_emalloc(sizeof(temp_variable), op_array->T, 0);
+ if (op_array->T < TEMP_VAR_STACK_LIMIT) {
+ EX(Ts) = (temp_variable *) do_alloca(sizeof(temp_variable) * op_array->T);
+ } else {
+ EX(Ts) = (temp_variable *) safe_emalloc(sizeof(temp_variable), op_array->T, 0);
+ }
EX(prev_execute_data) = EG(current_execute_data);
EX(original_in_execution)=EG(in_execution);
@@ -1757,7 +1762,11 @@
(*EG(return_value_ptr_ptr))->is_ref = 0;
}
}
- efree(EX(Ts));
+ if (EX(op_array)->T < TEMP_VAR_STACK_LIMIT) {
+ free_alloca(EX(Ts));
+ } else {
+ efree(EX(Ts));
+ }
EG(in_execution) = EX(original_in_execution);
EG(current_execute_data) = EX(prev_execute_data);
return;