Re: NewEra performance difference between base types and object types
Posted in 1996
David Chan (dwc@cix.compulink.co.uk) wrote: > Should you use base type (INTEGER, DECIMAL, etc) or the object > type (ixInteger, ixDecimal, etc)? Which is faster? > I ran the following test and the results surprised me. The object > version took .5 seconds and the base version took 15 seconds. I also > tried mult, div, plus, etc. and the difference is not as impressive but > it is still better. > ## Example deleted I tried your example, and got the same result. But your test is of the type 'VAR += konst'. I modified it to run the test for 'VAR1 += VAR2'. Now the object type was five times SLOWER than the base type, which ran with the same speed as before. I suppose there is a better way to program this, to get the object-code run faster (Tell me if you know). -But I still think OO-programming is taking a few steps to far converting simple data types as integers into objects. My modification of the program added: ------------ include system "ixnum.4gh" main variable anInt1 ixInteger(0) variable anInt2 integer = 0 variable anInt3 ixInteger(2) variable anInt4 integer = 2 variable aCount integer display "start" -- dummy loop to see cost of for loop display current second to fraction(2) for aCount = 1 to 1000 end for -- use object type display current second to fraction(2) for aCount = 1 to 1000 call anInt1.plus(anInt3.getValueStr()) end for -- use base type display current second to fraction(2) for aCount = 1 to 1000 let anInt2 = anInt2 + anInt4 end for display current second to fraction(2) display "finish " return end main ------------ -- Frode Tvedten Systems dept Tollpost-Globe AS N-6301 'ndalsnes/Norway E-mail: ftv@it.tollpost.no Phone: (+47) 7122 6678 Fax: (+47) 7122 6694