As we know the integer storage length is 4 bytes and character storage is 1 byte.Here comes my problem,I have a huge data and I need to write them into a file.
For eg. my data is like
Integers - 123456789 (of length 9) (Total 9! factorial records)
Character - abcdefghi (of length 9) (Total 9! factorial records)
Which one will take less processing time? Any thoughts…
If your integers are stored in individual 32-bit ints and you save them in binary, you have 4 bytes per integer and no conversion overhead.
If your character strings are stored in arrays of 9 chars and you save them as-is, you have 9 bytes per string and no conversion overhead.
In this case strings will take more I/O time than integers.
If you convert your integers into readable 9-char strings and save them the same way as the other strings, the I/O time will be the same, but there will be extra processing time for the integers required for their conversion into text.