Is reading it in as a string then converting it to its known type slower at all? |
The obvious answer is yes, anytime you add another step, you add a small amount of processor time.
I think the real question is how much time and that is really hard to answer. For converting a single string to int for example, first you need to determine if 123 is truly an int, or if 123a is not a int. Time will depend on your method. Once that is determined, converting it is maybe a millisecond to two, even if I'm wrong, it is still a very short time.
So, a small file with a thousand strings would take lilttle time, and in human time, you wouldnt' even notice. A extremely huge file with millions or billions of strings would be best if you sorted the data first so that you could read the file and import each value with the correct type.
A example would be a list of prime numbers.
These would be a bad format because it would be difficult to read, and convert.
3,5,7,11,
3, 5, 7, 11,
Most prime number list I have seen and used look like this which is much easier to work with.
3 ; 5 ; 7 ; 11 ; 13 ; 17 ; 19 ; 23 ; 29 ; 31 ; 37 ; 41 ; 43 ; 47 ; 53 ; 59 ; 61 ; 67 ; 71 ; 73 ; 79 ; 83 ; 89 ; 97 ;
Even then with 500 million numbers it takes a while to work with, so you want to make everything as fast as possible.