ok basically im building a script that reads input and have to "make meaning" or the input. now basically im not worried about how to do the implementation, but im worried about how slow or how fast the script may run if i choose the wrong method. which would be preferred?:
- read chars 1 by 1
- Split that string into multiple sections, which are furthur split into more sections.
- a combination of the 2?
I would think that simply reading the value of a field as a whole string would be the fastest method.
Do you perhaps have an example / use case to better illustrate your problem?
erm not really. im using the charAt right now, but im worried if there is any performance issues with charAt when the string gets v long. say 15000 chars
If your input expectations are that long, is it really necessary to re-interpret the string character-by-character?
What you're actually going to do with the string once you've read it will affect performance more than the actual string reading.
Performance is also heavily dependent on the browser you're testing in. For example, a simple array.push() on 1,000,000 characters read in using charAt() in a for look will take approximately 30ms in Chrome, but can take up to 1400ms in IE8 (and about 450ms in Fx 3.6).
Could you perhaps give a use case of how you would need to interpret the string, what sort of things need to be done to it to "make meaning" out of it?