Computer Science Canada Why you might want to stay away from types... |
Author: | copthesaint [ Mon Jan 30, 2012 10:00 am ] | ||
Post subject: | Why you might want to stay away from types... | ||
Unfortionatly I decided to spend the time to see how efficient Types are compared to just plain variables. I made one type called X with values x and y and two variables callled x,y. When tested 100 times, and even 1000 times. my program shows that turing sets 2 normal types at approx 0.0002ms and turing on my computer sets 2 variables in types at 0.00027 ms. On my computer this fluxuates about +-0.00003 but I have not yet seen variables slower then types. Does this mean types are bad? I dont think so, considering its not even one tenth of a ms, but 1 ten thousandth of a ms. Generally you wont have to worry about a 0.0001ms difference. but its just good to know. Heres a program you can use to try on your computer.
|
Author: | DemonWasp [ Mon Jan 30, 2012 11:58 am ] | ||||
Post subject: | RE:Why you might want to stay away from types... | ||||
You might also find this interesting:
Example output:
So the following are all pretty much the same speed: global variables, local class member variables, procedure-local variables, loop-local variables, and global variables from within a method. Record members are somewhat slower, and array elements are quite slow; the slowest of all are accessing class members through indirection (->). This is just Turing being Turing, though: most other languages will post times of 60ms-600ms for those operations. I have only once encountered a language slower than Turing, and that's interpreted Javascript circa 2005; modern JS is way way faster. |
Author: | mirhagk [ Mon Jan 30, 2012 1:13 pm ] |
Post subject: | RE:Why you might want to stay away from types... |
You gotta remember Turing is like circa 2005 |
Author: | DemonWasp [ Mon Jan 30, 2012 1:53 pm ] |
Post subject: | RE:Why you might want to stay away from types... |
I might be thinking of Javascript even earlier, come to think of it. I think this data point is remembered from some benchmark done a long time ago that showed Javascript as being about 2000 times slower than compiled C++ for some code snippet, whereas some of my small tests showed Turing as "only" 100 times slower. I imagine the performance situation is a lot muddier than that, but the point stands: nothing is as slow as Turing. |
Author: | mirhagk [ Mon Jan 30, 2012 2:00 pm ] |
Post subject: | RE:Why you might want to stay away from types... |
I don't know demonwasp, some scripting languages might be slightly slower than turing lol. |
Author: | copthesaint [ Mon Jan 30, 2012 4:05 pm ] |
Post subject: | Re: Why you might want to stay away from types... |
DemonWasp wrote: So the following are all pretty much the same speed: global variables, local class member variables, procedure-local variables, loop-local variables, and global variables from within a method. Record members are somewhat slower, and array elements are quite slow; the slowest of all are accessing class members through indirection (->). This is just Turing being Turing, though: most other languages will post times of 60ms-600ms for those operations. I have only once encountered a language slower than Turing, and that's interpreted Javascript circa 2005; modern JS is way way faster. Thanks for expanding even further. Im sure people will appriciate it, or well at least I do lol |
Author: | crossley7 [ Mon Jan 30, 2012 9:31 pm ] |
Post subject: | RE:Why you might want to stay away from types... |
Well, I have found Filemaker Pro (A program similar to Microsoft Access) to have scripting that is fairly slow, but I have not done comparable tests to see which is slower, but I think it ranks up there. Then again, it is not a standard programming language and designed that way so it is not a fair comparison either |