HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

degredation in performance

10-22-2004, 05:58 AM#1
Guest
This is the trigger:

Code:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
  local integer k = 0
  local integer j = 0

    call DisplayTextToPlayer(Player(4), .2, .2, "trigger start...")
    call TriggerSleepAction(1)
    loop
      exitwhen j > 70
      call TriggerSleepAction(0)
      set k = 0
      loop
        exitwhen k > 99
        call DisplayTextToPlayer(Player(4), .2, .2, I2S(100*j + k))
        set k = k + 1
        set udg_i = udg_i + 1
      endloop
      set j = j + 1
    endloop

    call DisplayTextToPlayer(Player(4), .2, .2, "trigger end.")

endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_001, Player(4), "test", true )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction

Looks simple enough, ne? Loop and display text 7000 times each time it is run. However, by the second time you run it, there is a significant slowdown in the printing of the loop variable; by the 12th or 13th, each loop takes maybe half a second. Memory doesn't seem to increase, so from a programming standpoint, why would this happen?
10-22-2004, 06:05 AM#2
Miningjrk
It displays text 7 THOUSAND times?! EAch time run?!!! I see a major problem with that. Though I dont know how to fix your problem, I am curious as to why you would want text displayed 7 THOUSAND times.
10-22-2004, 07:12 AM#3
Guest
o.0 so I don't have to type `test' so often, of course! ^ ^

It just happened to be the correct order of magnitude to experience the lag problem.