HIGH PERFORMANCE PHP
First Claim
1. A computer-implemented method for efficiently executing server side script code on a server, the method comprising:
- retrieving a markup language document including server side script code specified using PHP syntax, wherein the server side script code is for execution on a server in response to a request for the markup language document;
generating C code from the server side script code, wherein the generated C code comprises;
one or more C classes comprising code corresponding to the server side script code,one or more C header files storing information describing structures of the C classes, andcode for memory allocation of objects instantiated from the C classes; and
compiling the generated C code to object code, wherein the object code is invoked for processing the markup language document.
2 Assignments
0 Petitions
Accused Products
Abstract
Markup language documents including server side scripting code using PHP syntax are executed efficiently in response to requests received by a server. The processing of the markup language document results in generation of a transformed markup language document that is returned in response to the request. The server side script code is input to a compiler that generates C code (or code in any object-based language based on C language) implementing the functionality of the server side script code. The C code is compiled to generated object code which is executed in order to process the markup language document. The generated C code includes functionality supported by PHP language including redeclaration of functions, dynamic variables, global variables, and the like. The generated C code invokes memory allocation code that allocates and deallocates objects obtained by instantiating the generated C classes.
65 Citations
20 Claims
-
1. A computer-implemented method for efficiently executing server side script code on a server, the method comprising:
-
retrieving a markup language document including server side script code specified using PHP syntax, wherein the server side script code is for execution on a server in response to a request for the markup language document; generating C code from the server side script code, wherein the generated C code comprises; one or more C classes comprising code corresponding to the server side script code, one or more C header files storing information describing structures of the C classes, and code for memory allocation of objects instantiated from the C classes; and compiling the generated C code to object code, wherein the object code is invoked for processing the markup language document.
-
-
2. The computer-implemented method of claim 1, further comprising:
sending the object code to a production system that received and responds to web requests, wherein the object code is invoked in response to a web request received by the production system.
-
3. The computer-implemented method of claim 1, wherein the generated C code comprises a function invoke table that stores function pointers to locate C functions by name, each C function corresponding to a server side script function.
-
4. The computer-implemented method of claim 1, wherein the generated C code comprises a global variables class comprising definitions of global variables, each global variable corresponding to a server side script global variable.
-
5. The computer-implemented method of claim 1, wherein the server side script code comprises dynamic variables and the generated C code comprises a mapping from strings representing variable names to structures representing variable values.
-
6. The computer-implemented method of claim 1, wherein the server side script code comprises a first declaration of a function and a second declaration of the function and the generated C code comprises a structure with a function pointer to one of a first C function corresponding to the first declaration and a second C function corresponding to the second declaration.
-
7. The computer-implemented method of claim 1, wherein retrieving the markup language document is responsive to receiving a request identifying the markup language document.
-
8. The computer-implemented method of claim 1, wherein the generated C code comprises C static variables allocated in the process memory that are accessible from multiple threads.
-
9. The computer-implemented method of claim 1, wherein the code for memory allocation allocates a set of multiple objects of the same size
-
10. The computer-implemented method of claim 1, wherein the code for memory allocation allocates variable sized objects that are stored in a persistent store and used subsequently for initializing global state of the C code in execution.
-
11. A computer-implemented method for efficiently executing PHP script code on a server, the method comprising:
-
receiving object code obtained by compiling C code, wherein the C code is generated from a server side script code specified using PHP syntax and implements functionality of the server side script code, the generated C code comprising; one or more C classes comprising code corresponding to the server side script code, one or more C header files storing information describing structures of the C classes, and code for memory allocation of objects instantiated from the C classes; receiving a request identifying a markup language document including the server side script code; and responsive to the request, executing instructions in the object code corresponding to the server side script code.
-
-
12. The computer-implemented method of claim 11, further comprising:
responsive to the request, sending a transformed markup language document obtained from the markup language document subsequent to executing the server side script code.
-
13. The computer-implemented method of claim 11, wherein the generated C code comprises a function invoke table that stores function pointers to locate C functions by name, each C function corresponding to a server side script function.
-
14. The computer-implemented method of claim 11, wherein the generated C code comprises a global variables class comprising definitions of global variables, each global variable corresponding to a server side script global variable.
-
15. The computer-implemented method of claim 11, wherein the server side script code comprises dynamic variables and the generated C code comprises a mapping from strings representing variable names to structures representing variable values.
-
16. The computer-implemented method of claim 11, wherein the server side script code comprises a first declaration of a function and a second declaration of the function and the generated C code comprises a structure with a function pointer to one of a first C function corresponding to the first declaration and a second C function corresponding to the second declaration.
-
17. The computer-implemented method of claim 11, wherein the generated C code comprises C static variables allocated in the process memory that are accessible from multiple threads.
-
18. The computer-implemented method of claim 11, wherein the code for memory allocation allocates a set of multiple objects of the same size
-
19. The computer-implemented method of claim 11, wherein the code for memory allocation allocates variable sized objects that are stored in a persistent store and used subsequently for initializing global state of the C code in execution.
-
20. A computer program product for storing object code implementing functionality for efficiently executing server side script code, the computer program product comprising:
object code obtained by compiling C code, wherein the C code is generated from a server side script code specified using PHP syntax and implements functionality of the server side script code, the server side script code included in a markup language document identified in a request received by a server, the generated C code comprising; one or more C classes comprising code corresponding to the server side script code, one or more C header files storing information describing structures of the C classes, code for memory allocation of objects instantiated from the C classes, a function invoke table that stores function pointers to locate C functions by name, each C function corresponding to a server side script function, and a global variables class comprising definitions of global variables, each global variable corresponding to a server side script global variable.
Specification