A code caching system comprising: one or more processors; and a machine-readable medium comprising instructions stored therein, which when executed by the one or more processors, cause the one or more processors to perform operations comprising: receiving a first indication of primary source code awaiting execution; checking a resource cache for cached data corresponding to the primary source code in response to receiving the first indication; and upon a cache miss in the resource cache: obtaining first executable code compiled from the primary source code; executing the first executable code once or multiple times in a first execution context and obtaining execution results from execution of the first executable code in the first execution context, wherein the execution results indicate a number of times secondary source code referenced in the primary source code is executed at the execution of the primary source code; selecting the secondary source code referenced in the primary source code based on the execution results; obtaining second executable code compiled from the selected secondary source code; serializing the first executable code and the second executable code into serialized code; and storing the serialized code as cached data in the resource cache. one or more processors; and a machine-readable medium comprising instructions stored therein, which when executed by the one or more processors, cause the one or more processors to perform operations comprising: receiving a first indication of primary source code awaiting execution; checking a resource cache for cached data corresponding to the primary source code in response to receiving the first indication; and upon a cache miss in the resource cache: obtaining first executable code compiled from the primary source code; executing the first executable code once or multiple times in a first execution context and obtaining execution results from execution of the first executable code in the first execution context, wherein the execution results indicate a number of times secondary source code referenced in the primary source code is executed at the execution of the primary source code; selecting the secondary source code referenced in the primary source code based on the execution results; obtaining second executable code compiled from the selected secondary source code; serializing the first executable code and the second executable code into serialized code; and storing the serialized code as cached data in the resource cache. receiving a first indication of primary source code awaiting execution; checking a resource cache for cached data corresponding to the primary source code in response to receiving the first indication; and upon a cache miss in the resource cache: obtaining first executable code compiled from the primary source code; executing the first executable code once or multiple times in a first execution context and obtaining execution results from execution of the first executable code in the first execution context, wherein the execution results indicate a number of times secondary source code referenced in the primary source code is executed at the execution of the primary source code; selecting the secondary source code referenced in the primary source code based on the execution results; obtaining second executable code compiled from the selected secondary source code; serializing the first executable code and the second executable code into serialized code; and storing the serialized code as cached data in the resource cache. obtaining first executable code compiled from the primary source code; executing the first executable code once or multiple times in a first execution context and obtaining execution results from execution of the first executable code in the first execution context, wherein the execution results indicate a number of times secondary source code referenced in the primary source code is executed at the execution of the primary source code; selecting the secondary source code referenced in the primary source code based on the execution results; obtaining second executable code compiled from the selected secondary source code; serializing the first executable code and the second executable code into serialized code; and storing the serialized code as cached data in the resource cache.