I'm idiot or the TList are very slow ????

BlitzMax Forums/BlitzMax Programming/I'm idiot or the TList are very slow ????

Filax(Posted 2005) [#1]
Hi

I'm working on a piece of blitz3D code converted to bmax, it's a little
realtime raytracer that i have find from DBF forum

The first code use array to store scene primitive object
the program start very quick.

This the code :


And the second code is the same than the first !!! the only difference ?
i use TList to store all objects, the result is 6x more long to start ??? and the program run very very slowwwwww ....

Here is code :


Any idea about program start longer ?


amonite(Posted 2005) [#2]
I had a look at your code, ran it and same for me exept that the 2nd one took ages to start compared to the 1st piece of code. Unfortunatly i couldn't come up with any solution...
will try again later for i found it interresting, though a bit confusing for my current knowledge.

maybe someone else will be able to help you there...


Scott Shaver(Posted 2005) [#3]
I tried both and the second starts much slower and runs much slower. I changed it to use an array for the sphere objects and it still started slow but ran much faster than it does using the TList.

Noticed that I forgot to change the shadowed() function to use the array. Once I changed this the start up time was the same as the fast one. So it looks like traversing TList (with a for loop, at least) is extreemly slow.


Mystik(Posted 2005) [#4]
Try sticking a flushmem in each of the Eachin loops. Makes the startup faster on mine.

Steve.


Filax(Posted 2005) [#5]
You are right, a flushmem in the function
Function setupnormals()

Reduce the startup time ! but for the rest ...

It's really really strange ?? any idea mark ?


marksibly(Posted 2005) [#6]
Hi,

First the good news - under the new, soon-to-be-released version, startup time went from 25s to 1s with no modifications!

As for the list version being slower, well, list's are slower than arrays so it will be a little slower.

A couple of factors are likely to be compounding this too. For one, much of the time rays are hitting 'nothing', so the overhead of lists will be more apparent. If each ray hit 'something', than the difference would likely be much less profound.

And looking at the code, I would also guess that some kind of 'critical point' is being reached in the list version, which is causing the compiler to spill a bunch of registers or something. The array version is pretty much, 'call free' in it's outer loop.

It might also be an idea to rewrite it in 'strict' mode, moving locals into the scope in which they actually appear. This can help the compiler reuse registers more efficiently.


Scott Shaver(Posted 2005) [#7]

First the good news - under the new, soon-to-be-released version, startup time went from 25s to 1s with no modifications!



Wow! Is that on windows only or on the Mac as well?


Jay Kyburz(Posted 2005) [#8]
Mark, Can you tell us anything about super strict? Does anybody else know?


marksibly(Posted 2005) [#9]
Hi,


Wow! Is that on windows only or on the Mac as well?



Mac too!


Mark, Can you tell us anything about super strict? Does anybody else know?



SuperStrict will appear in the next release and adds the following limitations to Strict:

* No 'anonymous int' decls allowed, eg: 'Local x' wont work, you must use 'Local x:Int' (or 'Local x%'). I couldn't see the point in disallowing '%', '#' etc as some people wanted (and some didn't): the point is to force the programmer to declare a type.

* If a function doesn't declare a return type, eg 'Function T()', any Return statements must NOT include an expression - and vice versa.

I haven't tweaked with conversion/casting rules though.


Jay Kyburz(Posted 2005) [#10]
Thanks!


Robert Cummings(Posted 2005) [#11]
What about capital letters for super strict? thats one of the more requested things...

Const helloWorld% = 10

If I go helloworld it should throw an error...


taxlerendiosk(Posted 2005) [#12]
I don't like the idea of case sensitive variable names. What's next, enforced indentation?


Gabriel(Posted 2005) [#13]
I don't like the idea of case sensitive variable names. What's next, enforced indentation?


In what way is it enforced? Don't want it? Don't use it. Don't type "Super Strict" at the beginning of your source file.


taxlerendiosk(Posted 2005) [#14]
I thought SuperStrict already means other things as well (function return values?) that I might want. I already use Strict all the time.


Perturbatio(Posted 2005) [#15]
if it really really must be implemented (although I really don't see the need to require case sensitivity) then it would be better implemented as an optional parameter to SuperStrict mode.


Tom Darby(Posted 2005) [#16]
Y'know, we should really have something more than SuperStrict--sure, it helps, but it's still far too lax for my tastes. We need something that enforces indentation, case sensitivity, explicit casting, declaration, IEEE standards, function returns, Hungarian notation, good coding style, Y2K compliance, and a full-and-proper CRLF at the end of every line, dammit.

I suggest we call it "MasochiStrict". Mark, what do you think?


Fetze(Posted 2005) [#17]
Isn't there a way to fasten Lists a little? Maybe rewriting the List-Module in super-optimized C or Assembly? I heard something about C being around 20% faster than Blitzmax and if we could get 20% faster TLists, it would be a great help.

I'd also like to see Graphical stuff running a little faster. ;)


xlsior(Posted 2005) [#18]
Isn't there a way to fasten Lists a little?


If you look at Mark's posting above, you'll find that he has done that already:

First the good news - under the new, soon-to-be-released version, startup time went from 25s to 1s

However, this update has not yet been published yet... But it does sound like we can expect a big speed boost for lists when the next update hits the streets.


Eikon(Posted 2005) [#19]
First the good news - under the new, soon-to-be-released version, startup time went from 25s to 1s
However, this update has not yet been published yet...

No need to wait for the update, just look here:

http://www.blitzbasic.com/Community/posts.php?topic=50965