expr-lang/expr

BuildInd Func

maxpy opened this issue · 1 comments

	var s1 runtime.MemStats
	runtime.GC()
	runtime.ReadMemStats(&s1)
	for i := 0; i < 100000; i++ {
		go func() {
			BuildInd("xw1(BTC_1m, 30, 30, 30, 40, 40, 40, 0.3, 0.3, 0.8, 0.8, 0.8, 1.2)") // compile with expr
			// XW1Indi(prices, 30, 30, 30, 40, 40, 40, 0.3, 0.3, 0.8, 0.8, 0.8, 1.2)  // direct call
		}()
	}
	time.Sleep(20 * time.Second)
	runtime.GC()
	var stats2 runtime.MemStats
	runtime.ReadMemStats(&stats2)
	indi.Logger.Infof("memstats diff TotalAlloc:%d HeapInuse:%d HeapIdle:%d HeapReleased:%d StackInuse:%d StackSys:%d", stats2.TotalAlloc-s1.TotalAlloc, stats2.HeapInuse-s1.HeapInuse, stats2.HeapIdle-s1.HeapIdle, stats2.HeapReleased-s1.HeapReleased, stats2.StackInuse-s1.StackInuse, stats2.StackSys-s1.StackSys)

compile with expr log:
memstats diff TotalAlloc:5270050752 HeapInuse:25812992 HeapIdle:1068834816 HeapReleased:1026441216 StackInuse:65536 StackSys:65536
direct call log:
memstats diff TotalAlloc:694453424 HeapInuse:8069120 HeapIdle:3956736 HeapReleased:18446744073703309312 StackInuse:557056 StackSys:557056

BuildInd?