The json encoder in LambdaMarshaller.marshall_response turns unicode characters into unicode escape sequences (i.e. \u0123) instead of regular unicode characters.
As a result, a unicode character contributes 6 bytes to the response size of the lambda instead of 2 bytes like a normal unicode character. The runtime interface clients for other languages (Ruby and NodeJS) do not produce unicode escape sequences. In the hypothetical case of a lambda that returns all unicode characters, a Ruby or NodeJS lambda function could return 3x as much data as a Python lambda function.
The json encoder in
LambdaMarshaller.marshall_response
turns unicode characters into unicode escape sequences (i.e.\u0123
) instead of regular unicode characters.https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/970e9c1d2613e0ce9c388547c76ac30992ad0e96/awslambdaric/lambda_runtime_marshaller.py#L52
As a result, a unicode character contributes 6 bytes to the response size of the lambda instead of 2 bytes like a normal unicode character. The runtime interface clients for other languages (Ruby and NodeJS) do not produce unicode escape sequences. In the hypothetical case of a lambda that returns all unicode characters, a Ruby or NodeJS lambda function could return 3x as much data as a Python lambda function.
https://github.com/aws/aws-lambda-ruby-runtime-interface-client/blob/bbb95b2563344cef651828bd19e72de091d9a470/lib/aws_lambda_ric/aws_lambda_marshaller.rb#L32
https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/blob/9591537e98806494617281a362dbdc33b3853680/src/RuntimeClient/RuntimeClient.ts#L243