speed-up : avoid using forEach and hasOwnProperty in critical code