whats faster?
which would be faster, multiple switch statements for 10 differnt things or a buffered txt file with 10 differnt lines that has all the data for ech?; im using switch statmetns right now and this class file is only 8kb so its not hurting anything really; i guess wht im wondering is which would be the most "ideal" to use
Message was edited by:
ByronTheOmnipotent
1) Any time you need to know which is faster, the only way to find out for sure is to test them and see.
2) Most of the time when you think you need to know which is faster, you don't. As you study computer science and gain experience developing software, you'll learn the general performance characteristics of various algorithms in various scenarios, and you'll develop a feel for when the different performance profiles will and will not matter.
For example, approach A might take 10 ms while approach B takes 10 sec., so of course you'll go with approach A, right? It's a thousand times faster! But what if A is more complicated, harder to understand, harder to test, takes 3 days to develop, and approach B is much simpler and takes 2 hours to develop? And what if the code is only called once in a transaction that takes several minutes? The fact that A is 1000 times faster and saves several seconds is now suddenly much less significant.
jverda at 2007-7-29 14:46:23 >

FYI:
Here's one way to measure the difference in time (there are other ways)
long startTimeMillsec= (Calendar.getInstance()).getTime();
//put your code here
long endTimeMillsec= (Calendar.getInstance()).getTime();
long diffoTime= endTimeMillsec-startTimeMillsec;