encode_value: Slightly faster encode of large integers.
Also, do not remember items with only 1 reference, they are rather
unlikely to show up again later on (objects notwithstanding, and they
are handled in another case).
This saves a lot of CPU time when a large array of fairly unique
strings are encoded.