theam / aws-lambda-haskell-runtime

⚡Haskell runtime for AWS Lambda
https://theam.github.io/aws-lambda-haskell-runtime/
Other
270 stars 48 forks source link

More efficient context initialization #76

Closed dnikolovv closed 4 years ago

dnikolovv commented 4 years ago

As mentioned in #75, I am not sure whether it's a safe assumption that logStream and logGroup cannot change without the lambda having to be restarted.

Regardless, even if we read logStream and logGroup every time, there's still going to be a performance improvement from not reading the other 3 environment variables.


A weird thing is that I benchmarked a test lambda I have with this implementation and compared it to version 2.0.6. The differences are so staggering that I think I simply messed up the benchmarks.

Screenshot from 2020-06-19 18-17-16

Screenshot from 2020-06-19 18-10-38

It'd be great if someone can test and verify that these differences actually make sense.

@NickSeagull could you help with benchmarking?

Edit:

I made another benchmarking attempt, this time being more careful. The differences are very insignificant, actually, but still visible.

image

Closes #75