aws / aws-lambda-python-runtime-interface-client

Apache License 2.0
262 stars 74 forks source link

[Performance] Reduce unnecessary copying of strings and objects #129

Open marcomagdy opened 10 months ago

marcomagdy commented 10 months ago

Description of changes:

This patch attempts to improve performance by doing the following:

  1. Remove an extra getenv call, which internally involve a bunch of string copying.
  2. Avoid default constructing the invocation_request object only to overwrite it later with the actual request. Instead use a reference.
  3. Avoid copying the request string when we can pass it by reference

Testing:

Target (OCI, Managed Runtime, both):

Both

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

marcomagdy commented 10 months ago

FWIW, I wrote the native the client.