optimized reading and writing base-strings