memoize output optimization done