Speed up notice generation by avoiding copying data and putting most common cases on top

The speed up is quite substantial, 5-7 times faster.