I don't think it is slow because the strings are often short. Furthermore, this allows for a lot of flexibility. You can change a string easily. If you use things like C enums (day you have a set of static ints), it requires your knowing all the possibilities up-front, which effectively constrains you a lot. Your code will be much harder to evolve.
If performance is an issue, you can usually tackle it later and you might change the strings into ints to make it faster at that time, but I doubt that string parsing will be a performance bottleneck.
If performance is an issue, you can usually tackle it later and you might change the strings into ints to make it faster at that time, but I doubt that string parsing will be a performance bottleneck.
quote: Originally posted by Rüdiger on 02-22-2001 08:54 AM And now for something completely different: I volunteered to code the Map Generator and had a first look over the code that Mark sent me. I have seen that strings are often used as parameters for function calls. Isn't that a little slow, parsing strings "all the time"? Maybe one of the more experienced programmers could answer that? ---- Programmers don't die, they just GOSUB without RETURN. |
Comment