Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
mega_
Beginner


Joined: 15 May 2003
Posts: 16
Location: Estonia

PostPosted: Thu Feb 19, 2004 8:39 pm   

Speed problem while looping trough mapper in 7.01
 
Hey
I ran into this problem while upgrading from 6.62 to 7.01. What this script is supposed to do is to capture the roomname from somewhere(irrelevant here) and then loop trough the entire zone and add all vnums to array @room_ids. It worked perfectly in 6.62, however after upgrade the #loop part is incredibly slow. Getting pretty desperate here, any ideas how to do it some other way? or why is it so slow?

#CLASS {whe|whe_class} {disable}
#TRIGGER {(%w*) (*)$} {
room_name = %2
#ECHO ruum: @room_name
#CALL %mapfilter(%concat("ZoneID = ",%zonenum()))
#VARIABLE room_ids %array( )
#VARIABLE index 0
#LOOP %numrooms {
#SHOW room%i
#IF (@room_name = %roomname( %mapvnum( %i))) {
#NOOP %arrset( room_ids, @index, %mapvnum( %i))
#IF (@index < 12) {#ADD index 1} {#ABORT}
}
}
#CALL %mapfilter("")
#T- whe_class
}
#CLASS 0

Thanks in advance
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Fri Feb 20, 2004 1:14 am   
 
Make sure the Properties window and Spreadsheet view windows in the Mapper are closed. Also make sure zMapper is not running. Those things can slow it down. Don't have any other suggestion though. Scripting goes to great length to ensure that the mapper cache and the database file on disk stay in synch, and it might be that slowing it down.
Reply with quote
mega_
Beginner


Joined: 15 May 2003
Posts: 16
Location: Estonia

PostPosted: Fri Feb 20, 2004 10:48 am   
 
#mapquery command is extremly fast, but can i output the results in any other way than that spreadsheet?.p I just went back to 6.62, because its INSANELY slow to do map scripting in the way i did it. On the other hand i like 7.01 features so much that i'd gladly rewrite everything, any other guidance?

p.s. keep up the good work :)
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Feb 20, 2004 5:44 pm   
 
Try using a record-variable to see if it's faster than the array.
#CLASS {whe|whe_class} {disable}
#TRIGGER {(%w*) (*)$} {
room_name = %2
#ECHO ruum: @room_name
#CALL %mapfilter(%concat("ZoneID = ",%zonenum()))
#VARIABLE room_ids {}
#VARIABLE index 0
#LOOP %min( %numrooms, 12) {
#SHOW room%i
#IF (@room_name = %roomname( %mapvnum( %i))) {
#ADDKEY room_ids %i {%mapvnum( %i)}
#IF (@index < 12) {#ADD index 1} {#ABORT}
}
}
#CALL %mapfilter("")
#T- whe_class
}
#CLASS 0

NOTE: If you use copy/paste on this, be sure to remove the strike-out lines.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Fri Feb 20, 2004 7:23 pm   
 
I'll need a lot more details on this. I just tried the command:

#ALIAS test {
#CALL %mapfilter(%concat("ZoneID = ",%zonenum()))
#VARIABLE room_ids %array( )
#VARIABLE index 0
#LOOP %numrooms {
#SHOW room%i
#SHOW %roomname( %mapvnum( %i))
}
#CALL %mapfilter("")
}

and using the Sample MUD map, doing "test" shows it looping through the zone very quickly. So, it seems fine to me. How many rooms are in your map? If you've got a huge map file, then the %mapfilter might take a while. In 6.62 only a single zone was loaded at any given time. In 7.x the entire map is loaded into the memory cache. So, if you have *lots* of huge zones, the %mapfilter might be taking longer.

Someone has asked for a functional version of #mapquery and it's on the to-do list if its easy. But no guarentee it will be in the next versions.
Reply with quote
mega_
Beginner


Joined: 15 May 2003
Posts: 16
Location: Estonia

PostPosted: Fri Feb 20, 2004 11:27 pm   
 
I kind of solved the problem, using more complex mapfilter, but it is still alot slower than before. Thanks for the advice Lightbulb, somehow i decided to go for record variables durning my tests before reading this ehee :) Didnt make any difference tho.. Just for info, the #show command in the loop is just there for testing purposes to see how fast it actually goes trough the map.

Details?:p
Alot of zones, 15k rooms or soin total, most zones are small.. 400 or so at biggest, average is somewhere between 100 and 150..

The weird thing just was that.. the same script (The syntax i posted at start) went trough 450 rooms in like 10 milliseconds before and it takes 10+ seconds with 7.01.

Thanks for all help tho and i'd really love to see the functional version of mapquery :)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net