opencontainers / runtime-tools

OCI Runtime Tools
https://www.opencontainers.org/
Apache License 2.0
434 stars 141 forks source link

Improve performance of AddProcessEnv #693

Closed umohnani8 closed 5 years ago

umohnani8 commented 5 years ago

AddProcessEnv was sequentially going through the env array to check for duplicates, which would become very slow if we add a huge amount of ENV vars. Add a map to Generator to keep track of the ENV vars already added, so that when AddProcessEnv checks for duplicates, it is much faster. Also add a new function called AddMultipleProcessEnv, which takes a []string of ENVs and adds them to the config in one go. Add unit tests for these functions.

Signed-off-by: Urvashi Mohnani umohnani@redhat.com

umohnani8 commented 5 years ago

@mrunalp PTAL

mrunalp commented 5 years ago

LGTM

Approved with PullApprove

mrunalp commented 5 years ago

@vbatts ptal

umohnani8 commented 5 years ago

@vbatts ping :)

vbatts commented 5 years ago

couple of thoughts, but otherwise LGTM

umohnani8 commented 5 years ago

@vbatts addresses comments, this should be ready now :)

vbatts commented 5 years ago

LGTM

Approved with PullApprove

umohnani8 commented 5 years ago

Anything more we need to do to get this in?