Snippet ForLoopHelper

emjlr3

Change can be a good thing
Reaction score
395
Ok.. I just stress tested small operations like +,-,*,/ against array reads and the small operations won.

45 fps vs 60 fps (math had yet to go down)


Math is faster than an array read

Looping through an array is faster than looping through a linked list

Myth debunked.



This is officially useless.

how do you explain my results here?

specifically here?

Switching from a struct array to linked lists added ~4fps to PeriodicLoop.
 

Bribe

vJass errors are legion
Reaction score
67
I don't know how Nes came to the idea that JASS linked lists are slower than linear
stacks, but his tests did not prove that.

JASS:
local integer i = stack.top -1
local thistype this
loop
    exitwhen i < 0
    set this = stack<i>
    //
    set i = i - 1
endloop</i>


JASS:
local thistype this = head.next
loop
    exitwhen this == 0
    //
    set this = this.next
endloop


He didn't prove that the linked list (2nd example) is slower than the linear
stack (1st example). In normal programming, yeah it's possible the first one
is faster, but this is interpreted programming, JASS programming, notoriously
slow. Your benchmarks that showed an FPS increase when switching to linked
list should be fairly accurate.
 

Nestharus

o-o
Reaction score
84
Bribe, I ask you again...

what on earth does your post have to do with this submission.


This submission would be example one, but slower.
 

Bribe

vJass errors are legion
Reaction score
67
I was replying to emjlr3 who made that comparison, because he brought up the
point that you and I discussed on THW about Timer32-esque linked list versus a
linear-stack-loop.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top