Revert "Try without recurson"

This reverts commit 76e3663b2b1f1b58f9097f45124add4fa7718199.

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-06-28 18:47:16 +02:00
parent 9094405537
commit 3a9f1bf9a2
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA

View File

@ -360,7 +360,6 @@ var importAnalyzeCmd = &cli.Command{
}
totalTime += tse.Duration
var execStack = make([]types.ExecutionTrace, 0, 100)
for _, inv := range tse.Trace {
if inv.Duration > leastExpensiveInvoc {
expensiveInvocs = append(expensiveInvocs, Invocation{
@ -368,33 +367,8 @@ var importAnalyzeCmd = &cli.Command{
Invoc: inv,
})
}
execStack = append(execStack, inv.ExecutionTrace)
for len(execStack) != 0 {
et := execStack[len(execStack)-1]
execStack = execStack[:len(execStack)-1]
for _, gc := range et.GasCharges {
compGas := gc.ComputeGas
if compGas == 0 {
compGas = 1
}
ratio := float64(compGas) / float64(gc.TimeTaken.Nanoseconds())
ratio = 1 / ratio
if math.IsNaN(ratio) {
log.Errorf("NaN: comGas: %f, taken: %d", compGas, gc.TimeTaken.Nanoseconds())
}
s := chargeStats[gc.Name]
if s == nil {
s = new(stats)
chargeStats[gc.Name] = s
}
s.AddPoint(ratio)
}
execStack = append(execStack, et.Subcalls...)
}
tallyGasCharges(chargeStats, inv.ExecutionTrace)
}
if len(expensiveInvocs) > 4*invocsKeep {
sort.Slice(expensiveInvocs, func(i, j int) bool {