use hash to store pre-calced results and now exec time is 4s