The metrics provided by Lambda are very accurate as they are used to determine billing, with a caveat that the execution time reported does not include network latency incurred in calling the lambda and AFAIK it also does not include time spent provisioning the container on cold starts (it does included time spent initializing your code in the container, but I don't think it includes time spent starting the container itself, copying code, etc.)
In conclusion I don't think you can get more accurate measurements for memory used but for the execution duration there are other ways you may want to look at the data depending on what you care about.
However, if you just want to A/B test two different function implementations, executing in the same environment with the same input data, you can probably rely on the Lambda reported metrics.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…