Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This should make the script processor safe to be used across multiple goroutines. It compiles the script once. And loads it into a pool of VMs. Each invocation of Run() grabs a VM instance from the pool and returns it when complete. Fixes #13690 ``` $ benchcmp master.txt pool.txt benchmark old ns/op new ns/op delta BenchmarkBeatEventV0/Put-12 2271 2597 +14.35% BenchmarkBeatEventV0/timeout_Put-12 2449 2783 +13.64% BenchmarkBeatEventV0/Object_Put_Key-12 2155 2374 +10.16% BenchmarkBeatEventV0/timeout_Object_Put_Key-12 2365 2602 +10.02% BenchmarkBeatEventV0/Get-12 2315 2534 +9.46% BenchmarkBeatEventV0/timeout_Get-12 2480 2830 +14.11% BenchmarkBeatEventV0/Get_Object-12 2439 2872 +17.75% BenchmarkBeatEventV0/timeout_Get_Object-12 2669 3079 +15.36% BenchmarkBeatEventV0/Get_Undefined_Key-12 2588 2919 +12.79% BenchmarkBeatEventV0/timeout_Get_Undefined_Key-12 2789 3128 +12.15% BenchmarkBeatEventV0/fields_get_key-12 2382 2722 +14.27% BenchmarkBeatEventV0/timeout_fields_get_key-12 2663 2933 +10.14% BenchmarkBeatEventV0/Get_@metadata-12 2291 2460 +7.38% BenchmarkBeatEventV0/timeout_Get_@metadata-12 2515 2697 +7.24% BenchmarkBeatEventV0/Put_@metadata-12 2662 2492 -6.39% BenchmarkBeatEventV0/timeout_Put_@metadata-12 3038 2722 -10.40% BenchmarkBeatEventV0/Delete_@metadata-12 2229 2420 +8.57% BenchmarkBeatEventV0/timeout_Delete_@metadata-12 2452 2653 +8.20% BenchmarkBeatEventV0/Cancel-12 2274 2319 +1.98% BenchmarkBeatEventV0/timeout_Cancel-12 3198 2576 -19.45% BenchmarkBeatEventV0/Tag-12 2925 2668 -8.79% BenchmarkBeatEventV0/timeout_Tag-12 3107 2877 -7.40% BenchmarkBeatEventV0/AppendTo-12 2496 2428 -2.72% BenchmarkBeatEventV0/timeout_AppendTo-12 2570 2721 +5.88% benchmark old allocs new allocs delta BenchmarkBeatEventV0/Put-12 30 30 +0.00% BenchmarkBeatEventV0/timeout_Put-12 32 32 +0.00% BenchmarkBeatEventV0/Object_Put_Key-12 29 29 +0.00% BenchmarkBeatEventV0/timeout_Object_Put_Key-12 31 31 +0.00% BenchmarkBeatEventV0/Get-12 29 29 +0.00% BenchmarkBeatEventV0/timeout_Get-12 31 31 +0.00% BenchmarkBeatEventV0/Get_Object-12 32 32 +0.00% BenchmarkBeatEventV0/timeout_Get_Object-12 34 34 +0.00% BenchmarkBeatEventV0/Get_Undefined_Key-12 35 35 +0.00% BenchmarkBeatEventV0/timeout_Get_Undefined_Key-12 37 37 +0.00% BenchmarkBeatEventV0/fields_get_key-12 32 32 +0.00% BenchmarkBeatEventV0/timeout_fields_get_key-12 34 34 +0.00% BenchmarkBeatEventV0/Get_@metadata-12 29 29 +0.00% BenchmarkBeatEventV0/timeout_Get_@metadata-12 31 31 +0.00% BenchmarkBeatEventV0/Put_@metadata-12 30 30 +0.00% BenchmarkBeatEventV0/timeout_Put_@metadata-12 32 32 +0.00% BenchmarkBeatEventV0/Delete_@metadata-12 28 28 +0.00% BenchmarkBeatEventV0/timeout_Delete_@metadata-12 30 30 +0.00% BenchmarkBeatEventV0/Cancel-12 28 28 +0.00% BenchmarkBeatEventV0/timeout_Cancel-12 30 30 +0.00% BenchmarkBeatEventV0/Tag-12 28 28 +0.00% BenchmarkBeatEventV0/timeout_Tag-12 30 30 +0.00% BenchmarkBeatEventV0/AppendTo-12 28 28 +0.00% BenchmarkBeatEventV0/timeout_AppendTo-12 30 30 +0.00% benchmark old bytes new bytes delta BenchmarkBeatEventV0/Put-12 2112 2114 +0.09% BenchmarkBeatEventV0/timeout_Put-12 2208 2210 +0.09% BenchmarkBeatEventV0/Object_Put_Key-12 2096 2098 +0.10% BenchmarkBeatEventV0/timeout_Object_Put_Key-12 2192 2194 +0.09% BenchmarkBeatEventV0/Get-12 2096 2098 +0.10% BenchmarkBeatEventV0/timeout_Get-12 2192 2194 +0.09% BenchmarkBeatEventV0/Get_Object-12 2256 2258 +0.09% BenchmarkBeatEventV0/timeout_Get_Object-12 2352 2354 +0.09% BenchmarkBeatEventV0/Get_Undefined_Key-12 2416 2419 +0.12% BenchmarkBeatEventV0/timeout_Get_Undefined_Key-12 2512 2514 +0.08% BenchmarkBeatEventV0/fields_get_key-12 2256 2258 +0.09% BenchmarkBeatEventV0/timeout_fields_get_key-12 2352 2354 +0.09% BenchmarkBeatEventV0/Get_@metadata-12 2096 2098 +0.10% BenchmarkBeatEventV0/timeout_Get_@metadata-12 2192 2194 +0.09% BenchmarkBeatEventV0/Put_@metadata-12 2112 2114 +0.09% BenchmarkBeatEventV0/timeout_Put_@metadata-12 2208 2210 +0.09% BenchmarkBeatEventV0/Delete_@metadata-12 2080 2082 +0.10% BenchmarkBeatEventV0/timeout_Delete_@metadata-12 2176 2178 +0.09% BenchmarkBeatEventV0/Cancel-12 2080 2082 +0.10% BenchmarkBeatEventV0/timeout_Cancel-12 2176 2178 +0.09% BenchmarkBeatEventV0/Tag-12 2080 2082 +0.10% BenchmarkBeatEventV0/timeout_Tag-12 2176 2178 +0.09% BenchmarkBeatEventV0/AppendTo-12 2080 2082 +0.10% BenchmarkBeatEventV0/timeout_AppendTo-12 2176 2178 +0.09% ``` (cherry picked from commit 0338e66)
- Loading branch information