Accelerated cached object retrieval
First Claim
1. A programming environment including executable code for implementing a method for optimizing object generation, the method comprising:
- receiving, from a calling method, a first call for invocation of a target method including initialization code;
executing a first code version to perform the target method;
in response to the first code version executing successfully with no exceptions, the first code version dynamically replaces the first code version with a second code version to perform the target method in any subsequent invocations of the target method, whereinthe second code version does not include the initialization code, andthe dynamically replacing is performed without notification to the calling method;
receiving, from the calling method, a second call for invocation of the target method; and
in response to the second call, executing the second code version to perform the target method, the second code version comprises a singleton object wherein each object type of the singleton object has exactly one shared instance.
1 Assignment
0 Petitions
Accused Products
Abstract
Efficiency of cached objects such as singleton objects and other software constructs having a first-invocation cost is improved by replacing the software code for creating a method instance (the “creation code”) with the instance itself. Upon first invocation, the calling method causes the first version of the method to be performed, and also causes the first version to be replaced by the second version. Thus, the invention facilitates creation of singleton objects that run without any branch logic, so as to improve speed and efficiency. The need for locking and exception handling is reduced, resultant code is simplified, and potential for error is reduced.
-
Citations
8 Claims
-
1. A programming environment including executable code for implementing a method for optimizing object generation, the method comprising:
-
receiving, from a calling method, a first call for invocation of a target method including initialization code; executing a first code version to perform the target method; in response to the first code version executing successfully with no exceptions, the first code version dynamically replaces the first code version with a second code version to perform the target method in any subsequent invocations of the target method, wherein the second code version does not include the initialization code, and the dynamically replacing is performed without notification to the calling method; receiving, from the calling method, a second call for invocation of the target method; and in response to the second call, executing the second code version to perform the target method, the second code version comprises a singleton object wherein each object type of the singleton object has exactly one shared instance. - View Dependent Claims (2, 3, 4)
-
-
5. A non-transitory computer-readable medium having code stored thereon for causing a computer to perform a method for optimizing object generation, the method comprising:
-
receiving, from a calling method, a first call for invocation of a target method including initialization code; executing a first code version to perform the target method; in response to the first code version executing successfully with no exceptions, the first code version dynamically replaces the first code version with a second code version to perform the target method in any subsequent invocations of the target method, wherein the second code version does not include the initialization code, and the dynamically replacing is performed without notification to the calling method; receiving, from the calling method, a second call for invocation of the target method; and in response to the second call, executing the second code version to perform the target method, the second code version comprises a singleton object wherein each object type of the singleton object has exactly one shared instance. - View Dependent Claims (6, 7, 8)
-
Specification