|
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Sun Dec 21, 2008 9:00 pm
Display Issues |
Well for Achaea I was still having problems with commands screwing up my display. Like it would cut room descriptions in half or the prompt in half on the display once in awhile.
Example:
3500h, 3800m, 16400e, 16400w cexdkick rat
b-
Stuff like that. This is annoying. It will also sometimes put the direction I send from command line inside of a room description on the display which cuts the line in half. I posted on this awhile back and no one ever responded after Zugg's post.
However, another thing I am curious about is the speed. It just seems slow to me, especially during large battles or when tons of text is coming in. What are some times you all get?
For instance, running a small test like:
Code: |
$time=%secs
#500 #show This is a test
#print This test took (%secs-$time) ms |
Took 1487 ms
With #print it only took 259 ms
Am I just being picky? On CTRL Q I get 25.6.
Does this compare to other people? |
|
|
|
Progonoi Magician
Joined: 28 Jan 2007 Posts: 430
|
Posted: Sun Dec 21, 2008 9:45 pm |
Well, I personally haven't had display issues like those you're explaining at all.
I did your test under my package, though it isn't by any means very large yet, and got an approximate 350 ms.
Somehow doing CTRL Q doesn't work for me in a non-untitled session, worked otherwise though but that number wouldn't
show anything concerning matters at hand.
I'm sure you've heard that before but maybe you should piece by piece look over your battle code. As you say
that's when the huge speed pumps usually happen.
Just my .002, heh. |
|
_________________ The Proud new owner of CMud.
--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
-------------------------------- |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sun Dec 21, 2008 11:08 pm |
Your test
Code: |
$time=%secs
#500 #show This is a test
#print This test took (%secs-$time) ms |
First #SHOW uses a very low level for where it puts things to display. It is even capable of replicating and testing telnet negotiations. This means #SHOW is testing all levels and is the most accurate test for actual mud text.
The CTRL-Q test is on a different level. Where it places the display stuff does not need to be tested for telnet items. This makes small reduction in its overall time. I can't tell just how many other things it skips compared to #SHOW
Next your loop count is 500, the CTRL-Q test uses a count of 1000. Obviously 500*2=1000 and 1487*2=2974, 2974 is similiar to the CTRL-Q of 25.6 which means 2560ms.
Finally #PRINT. This command was designed to bypass all forms of testing. It does get parsed for ansi codes, but is not checked for telnet items and is not tested against triggers. This command is the raw test of scrolling speed, and the best choice for displaying any information from a script to the user. Obviously this would have the fastest time.
You can also use the #FIRE command to preform a raw speed test of your triggers. There are always 2 things to consider when testing triggers: speed of rejection and speed of match. The best triggers reject extremely quickly, and that is most easily accomplished with the anchors ^ and $.
If you are having serious speed problems then you should definitely look into adjusting your trigger patterns. Based on your numbers you have 8000 triggers, a very slow computer, or some really bad patterns. Possibly a combination of a few of those things. Fixing patterns and using better diabling of triggers and classes will give you a major boost.
CMud2.37 has many major speed optimizations over previous versions. Many of those changes are the result of users doing tests just like you are and finding where a problem lies. My rule with such testing is always that a linear increase in time to loop count is ok, an exponential curve is a problem. A linear result may still be improvable, an exponential result is showing that some portion of the code is being called an increasing number of times for each loop iteration. I haven't found anything that falls into the problem category in quite a long time. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Dec 22, 2008 3:13 am |
The display problem, if I recall, is caused by CMUD's tolerance for MUDs that don't comply with the telnet standard. The problem occurs when your command is sent just as a packet boundary appears inside your prompt - the packet boundardy isn't terminated with any text, which isn't part of the telnet standard - prompts should be terminated with GA or EOR, and IRE muds do this properly.
Trouble is that many MUDs don't do this correctly - they just end the packet with no terminating sequence, and leave the client to work it out. So CMUD isn't going to wait around for a GA or EOR that may or may not be coming; instead, it assumes that the packet boundary is the end of a prompt and puts your command between the end of the first packet and the start of the second. Hence the display issue.
If I recall, a possible fix was suggested in that CMUD might detect or be told if the MUD is propery terminating its prompts with GA or EOR. If it is, then packet boundaries wouldn't be treated as prompts any more, and the problem should disappear. I can't remember if that suggestion was responded to as feasible or not, nor if it's on the wishlist. Zugg will know more.
As for speed, a short expansion on Viji's "speed of rejection" and "speed of match". These two aren't normally both achievable with the same pattern - rejection means that a line that doesn't match is rejected as quickly as possible, but may slow down a match on a line that fits the pattern; speed of match is the opposite, matching lines that fit the pattern as quickly as possible but rejecting lines that don't fit slightly slower. Which you're going to optimise for depends on how often the trigger fires compared to the volume of text and isn't something we can really help you with - you're going to have to use your own judgement.
Regexes have lots of features to help you adjust these two speeds - the two you'll probably use most frequently are non-greedy quantifiers (.+? versus .+) and atomic grouping and quantifiers (which are quite complex and should probably be read about on their own). But the short answer is that triggers take a lot of tweaking to get them running as quickly as they can.
The regex engine isn't the only factor in chug you might get during combat, either. Some script operations are slower than others and you can often write scripts slightly differently to improve speed, usually at a cost to readability or at an increase in headaches when trying to understand exactly what the code's doing. It's up to you whether or not you think it's worth it, and only you know your scripts well enough to find the problem areas - it takes some difficult debugging to find them sometimes, too.
My advice would be to use as few variables as you possibly can, and rely on local variables and events as much as possible. If you're going to be doing a lot of operations on a variable (like sorting it), it'll probably be more economical to put the value into a local variable and do your operations on that, putting the value back into the "real" variable at the end if you need to. This advice is so general that it's almost useless, I know, but it's the best I can offer :( |
|
|
|
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Mon Dec 22, 2008 7:09 am |
Quote: |
If you are having serious speed problems then you should definitely look into adjusting your trigger patterns. Based on your numbers you have 8000 triggers, a very slow computer, or some really bad patterns. |
All of this is untrue. I have 864 triggers. All of them are anchored, I use only regex, and they are optimized for speed.
My computer stats are the following:
AMD Athlon 64 3800+ 2.41 GHz
2.00 GB of RAM
Window XP Professional |
|
|
|
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Mon Dec 22, 2008 11:33 am |
Well I think most of the slow issue was simply due to some coloring triggers based off of a string list of names. One of those had 800 names in it. Another one had 300. So every single word was checking through those lists, which really was quite fast I guess.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Jan 05, 2009 6:46 pm |
To answer the original question, which I'm pretty sure I answered in your other post as well, CMUD can insert text on the screen anytime there is a packet break from the MUD. So in your example:
3500h, 3800m, 16400e, 16400w cexdkick rat
b-
the MUD had a packet break between the "cexd" and the "b-" text. Whenever there is a packet break from the MUD, CMUD is allowed to add any text that your triggers might generate.
Packet breaks can be very network dependent. The Internet is allowed to break network packets at any point. This can also be caused by TCP/IP packet properties in Windows, your network router, or your ISP.
It is not something I can change or fix in CMUD. Most MUDs do not mark the end of a MUD prompt in any way...just with a packet boundary. That is why CMUD is allowed to insert text to the screen after any packet boundary...because CMUD thinks it's at the end of a MUD prompt. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Jan 05, 2009 8:02 pm |
Is there really no way to add a preference for those playing MUDs that do properly terminate their prompts, though, to turn that off? I understand that you can't just ignore packet boundaries without breaking a lot of MUDs, but being able to selectively turn it off would fix this problem.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Jan 05, 2009 10:34 pm |
That is already on my to-do list for the future.
|
|
|
|
gamma_ray Magician
Joined: 17 Apr 2005 Posts: 496
|
Posted: Tue Jan 06, 2009 12:03 am |
I'm guessing that you're colouring city/order/etc. members/enemies based on a string list of names (I've fooled around with it myself, and yes, it is really bloody slow). You might want to look at this old thread about Patricia trees. Implementing something like that for those specific string lists would vastly improve your match time on names. Before you ask, I've fooled around with implementing it myself in a general way, and it's not for the faint of heart, CMud (understandably) doesn't have the best interface for implementing custom data structures... but it's certainly an interesting problem to while away the hours (days/months/years) with...
|
|
|
|
|
|