small optimization in the examples.

don't use append when the size of the slice is known in advance.