Memoize global-id instead of creating objects every time.