Lambda boilerplate overhead per stack.

9th September 2018


I’ve started looking into Lambda a little more. As I code with all 4 ‘main’ languages (C#, Go, Node, Python) I thought I’d see the relative performance of each as I’m quite happy to choose based on that kind of criteria for some projects - the kind of stuff that doesn’t necessarily benefit too much from any language’s strong points and so could be done by all of them.

  • The results are based on AWS overheads, and do not take into account throughput for actual running services.
  • A language that appears slow here may process more requests under real usage; this does not test that aspect.

There is no concept in this head to head of actual performance, it is all about the memory and start-up overheads of individual invocations. I fully expect for example (though am not blinkered enough that I cannot be dissuaded when I test it) that the scripting languages (Node and especially Python) will perform better here than a JIT system like C#, and yet C# will probably perform a lot better when it is warmed up. We’ll see; this is just part one.

In order to avoid bias and to go with AWS best practices, I used the Lambda console to create the default functions then tested them from that console without any code changes. They are what Amazon consider to be ‘out of the box’ minimal functions.

I did 8 runs with cold starts at runs 1 and 7 and the details are below. This is not scientific as each run was a manual trigger in the console, but for these purposes that doesn’t matter.

Basic stats

Code (mb) 1 (ms) 2 (ms) 3 (ms) 4 (ms) 5 (ms) 6 (ms) 7 (ms) 8 (ms) Resources (mb) Max (mb)
Go 1.4 0.67 0.42 5.81 36.85 0.41 23.95 15.57 16.57 128 22
Net 2.1 0.5 540.93 0.31 0.24 0.38 0.24 0.21 517.63 0.33 512 53
Node 0.3 32.79 0.52 0.34 0.34 10.93 8.53 33.80 6.41 128 44
Python 3 0.3 0.30 0.30 0.39 0.47 0.32 0.30 0.30 11.33 128 21


  • As stated, there were cold starts on runs 1 and 7. I have no explanation for run 4 (Go), 5 (Node), 6 (Go), or 8 (various).
  • Go and Python are better with resources, followed by Node, with C# trailing notably.
  • C# has a relatively huge cold start time. Node is quite small, with Python and Go being negligible.
  • Code size is not particularly relevant for any of the platforms (in terms of boilerplate overhead).
  • Ignoring cold start, C# has the most consistent timings. Then Python, with Node and Go being a little more ‘bumpy’.

Stats-based ranking

Resources Cold Start Timing Consistency
1. Python Python C# C#
2. Go Go Python Python
3. Node Node Node Node
4. C# C# Go Go

Overall summary

In the end, they are all good enough. Depending upon the project I’ll choose the one that comes with the toolchain and library support I need. If I’m still not sure, then I will wait for my follow-up post which will deal with real performance under typical usage.