check if the result already exists to avoid recalculation