<@UFSMET9UH> you can look into memoized functions ...
# suitescript
s
@Christiaan you can look into memoized functions that can store the results of previous function calls, so that subsequent calls use a saved value instead of executing a more expensive lookup again. Lodash has a memoize functionality built-in.