Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Lua ➜ Mapper module draw slowness

Mapper module draw slowness

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Ircria   (24 posts)  Bio
Date Sat 01 Sep 2012 06:00 PM (UTC)
Message
Hello,

While working with mapper.lua, I've noticed an unusual amount of slowness in the draw function. I'm unsure if it's just my settings or what, but I'm currently wondering if there would be a way to speed it up. The draw function is unedited, save for a check to see if the window is hidden before drawing it.
I apologize for any vagueness from this, or if this is a common complaint. I really do feel this is user error on my part, but I just wanted to be sure.

Profile after moving one room:
                 Function    Count  Seconds

                     draw        6   0.1020
               WindowLine     2184   0.0183
           WindowCircleOp     1086   0.0084
         WindowAddHotspot      552   0.0060
             WindowCreate        6   0.0042


Current settings:
map.default_mapconfig = {
	-- assorted colours
	BACKGROUND_COLOUR			= { name = "Background",	colour = 	ColourNameToRGB "lightseagreen", },
	ROOM_COLOUR					= { name = "Room",			colour =	ColourNameToRGB "cyan", },
	EXIT_COLOUR					= { name = "Exit",			colour =	ColourNameToRGB "darkgreen", },
	EXIT_COLOUR_UP_DOWN		 	= { name = "Exit up/down",	colour =	ColourNameToRGB "darkmagenta", },
	EXIT_COLOUR_IN_OUT			= { name = "Exit in/out",	colour =	ColourNameToRGB "#3775E8", },
	OUR_ROOM_COLOUR				= { name = "Our room",		colour =	ColourNameToRGB "black", },
	UNKNOWN_ROOM_COLOUR		 	= { name = "Unknown room",	colour =	ColourNameToRGB "#00CACA", },
	DIFFERENT_AREA_COLOUR	 	= { name = "Another area",	colour =	ColourNameToRGB "#009393", },
	SHOP_FILL_COLOUR			= { name = "Shop",			colour =	ColourNameToRGB "darkolivegreen", },
	POSTOFFICE_FILL_COLOUR		= { name = "Post Office",	colour =	ColourNameToRGB "yellowgreen", },
	BANK_FILL_COLOUR			= { name = "Bank",			colour =	ColourNameToRGB "gold", },
	NEWSROOM_FILL_COLOUR		= { name = "Newsroom",		colour =	ColourNameToRGB "lightblue", },
	MAPPER_NOTE_COLOUR			= { name = "Messages",		colour =	ColourNameToRGB "lightgreen" },
	
	ROOM_NAME_TEXT				= { name = "Room name text",colour = ColourNameToRGB "#BEF3F1", },
	ROOM_NAME_FILL				= { name = "Room name fill",colour = ColourNameToRGB "#105653", },
	ROOM_NAME_BORDER			= { name = "Room name box",	colour = ColourNameToRGB "black", },
	
	AREA_NAME_TEXT				= { name = "Area name text",colour = ColourNameToRGB "#BEF3F1",},
	AREA_NAME_FILL				= { name = "Area name fill",colour = ColourNameToRGB "#105653", },	 
	AREA_NAME_BORDER			= { name = "Area name box",	colour = ColourNameToRGB "black", },
	
	FONT = {
		name = get_preferred_font {"Dina", "Lucida Console", "Fixedsys", "Courier", "Sylfaen",} ,
		size = 8
	},
				 
	-- size of map window
	WINDOW = { width = 400, height = 400 },
	
	-- how far from where we are standing to draw (rooms)
	SCAN = { depth = 10},
	
	-- speedwalk delay
	DELAY = { time = 0.3 },
	
	-- how many seconds to show "recent visit" lines (default 3 minutes)
	LAST_VISIT_TIME = { time = 60 * 3 },	
}


Image of map for scale: http://i.imgur.com/aRURV.png

Any advice would be appreciated.

Thank you.
Top

Posted by Ircria   (24 posts)  Bio
Date Reply #1 on Sat 01 Sep 2012 06:30 PM (UTC)
Message
Er, yes. It did seem to be user error. I was calling mapper.draw 13 times per movement. Please disregard my idiocy, and my apologies for taking up your time
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #2 on Sat 01 Sep 2012 06:47 PM (UTC)
Message
I know this is subjective (Nick knows I can be a pain about performance) but IMO it's not just you. The mapper, like many of Nick's cooler plugin modules, was made as an example work to get user_developers started and motivated. There are many places in both the lua module and associated plugin where significant performance gains can be achieved through more efficient techniques (like making fewer, larger DB requests). Nick's take on plugin performance has historically been "good enough is good enough". And if you want something more, then it's up to you to work out the details. :)

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 01 Sep 2012 11:33 PM (UTC)
Message
I agree with Fiendish that there is probably room for improvement. Mind you, I'd want to measure that. The fewer DB requests may or may not make an observable difference.

You could probably cache stuff (I thought it did that already) so that once you have a room from the database it is read from memory next time.

To his credit, Fiendish has taken the original plugin and miniwindow concepts and made some rather stunning, and highly integrated, plugins.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


12,728 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.