optimizing retrieving the bytes array of a string