Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor get_ems_folders to create less strings
Creating some strings in this method is inevitable, since we are generating string paths based on this compiled info, but there were a lot of excessive strings being created because of it: - Both of the constants in this method were being created every time this method was called. For the DATACENTER_FOLDER_TYPE one, it was just used as a comparison as well - Using << where possible will avoid generating new substrings, so we are only creating one new string at most. - Deferred the `.dup` of full_path until a new string was known that it would be generated. This did require creating a new variable to hold on to the existing variable, but that wasn't a big deal and didn't increase the number of allocations. Split up some ternary operators as well just to make running profilers on this code easier to determine what as causing allocations (granularity in tracing object allocations in ruby is only down to a line by line basis).
- Loading branch information