• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Benchmark test 'request'

Status
Not open for further replies.
Level 9
Joined
Dec 26, 2007
Messages
202
No, this doesn't belong in the request forum IMO.
I'm just looking for someone who can benchmark (or speedtest) the following script VS HAIL, ABC, TT, TimerUtils (both) and HSAS.
Thanks.

JASS:
library_once DAS initializer Init

    globals
        private constant integer INT=1023
        // 
    endglobals

    private type store1 extends integer array[1023][40000]
    private type store2 extends store1 array[1023]
    globals
        private store2 store
    endglobals
    private function H2I takes handle h returns integer
        return h
        return 0
    endfunction

    function GetStruct takes handle h returns integer
        local integer i=H2I(h)-0x100000
        return store[i/INT][i-(i/INT)*INT]
    endfunction

    function StoreStruct takes handle h, integer xxx returns nothing
        local integer i=H2I(h)-0x100000
        set store[i/INT][i-(i/INT)*INT]=xxx
    endfunction

    private function Init takes nothing returns nothing
        local integer i=-1
        set store=store2.create()
        loop
            set i=i+1
            exitwhen i==store2.size
            set store[i]=store.create()
        endloop
    endfunction

endlibrary
 
Level 22
Joined
Dec 31, 2006
Messages
2,216
Modulo finds the remainder of a division and as far as I can see (i/INT)*INT doesn't. It just divides i with INT and then multiplies it with INT. So if i = 10 and INT = 5 it will be like this: (10/5)*5) which is 10.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
...
...
I would just tell you to see what the Blizzard's Modulo function does, but I will show you.
In your example 10%5 is 0
So
10 - (10/5)*5 = 0 So it is OK...
23 - (23/7)*7 = 23 - (3)*7 = 23 - 21 = 2
 
Status
Not open for further replies.
Top