iotex-core icon indicating copy to clipboard operation
iotex-core copied to clipboard

improve Actions(start uint64, count uint64)

Open dustinxie opened this issue 3 years ago • 0 comments

What would you like to be added: it collects action in reverse direction, see func (core *coreService) reverseActionsInBlock, in there a new slice is always allocated and existing slice appended after the new slice

res = append([]*iotexapi.ActionInfo{{
			Action:    selp.Proto(),
			ActHash:   hex.EncodeToString(actHash[:]),
			BlkHash:   blkHash,
			Timestamp: blk.Header.BlockHeaderCoreProto().Timestamp,
			BlkHeight: blkHeight,
			Sender:    sender.String(),
			GasFee:    gas.String(),
			Index:     uint32(ri),
		}}, res...)

Why is this needed: this is not efficient in both memory and running time, find a better solution to optimize it

dustinxie avatar Feb 09 '22 20:02 dustinxie