[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Development
. . -> [Subject]  ANSI color performance

ANSI color performance

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


Pages: 1 2  

Posted by Mudaddict   (8 posts)  [Biography] bio
Date Fri 31 Mar 2023 06:38 AM (UTC)
Message
I was wondering if anyone has any ideas on how to improve the ansi color rendering performance. It appears that if there is lots of ansi color text being displayed, the framerate of the renderer is significantly slower. So much so that on a fast pace mud fight that has over 100 lines of text, the renderer is so slow that the text of the next round would have already started before you can see the end of the first round.
This is in comparison to no ansi color and the text renders fast and perfectly fine.
This is definitely a render slowness issue because the mud triggers get sent in time and before the text is even rendered. So its not a network traffic issue.
I was looking at the code, and I think the ExtTextOut function is either slow for this purpose, or with ansi coloring, gets called many times. I did not debug this yet.
I did some research and found references to Direct2D drawing being slow, https://devblogs.microsoft.com/commandline/case-study-how-many-colors-are-too-many-colors-for-windows-terminal/
Not sure if that brings any insight.
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #1 on Fri 31 Mar 2023 05:49 PM (UTC)

Amended on Fri 31 Mar 2023 05:51 PM (UTC) by Fiendish

Message
Can confirm. This makes my client bog all the way down when the output is in view:


require "aardwolf_colors" -- https://raw.githubusercontent.com/fiendish/aardwolfclientpackage/MUSHclient/MUSHclient/worlds/plugins/aardwolf_colors.lua

ansi_string = ColoursToANSI(string.rep("@x026/@x227/@x195/@x191/@x085/", 30))
for i=1,100 do Simulate(ansi_string.."\r\n") end

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Fri 31 Mar 2023 10:44 PM (UTC)
Message
Also:


https://raw.githubusercontent.com/fiendish/aardwolfclientpackage/MUSHclient/MUSHclient/lua/string_split.lua

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Fri 31 Mar 2023 10:52 PM (UTC)
Message
I can't reproduce that. Using Fiendish's test code the client seems responsive both under Windows XP and under Ubuntu 22.04 using Wine.

Quote:

This makes my client bog all the way down when the output is in view:


You need to define that numerically. As far as I could see I could scroll up/down, and page up/down without any issues. Perhaps it is the font you are using? What font and what font size are you using for the test? I was using Fira Code.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Fri 31 Mar 2023 10:53 PM (UTC)

Amended on Fri 31 Mar 2023 10:55 PM (UTC) by Nick Gammon

Message
Mudaddict said:

I was wondering if anyone has any ideas on how to improve the ansi color rendering performance.


Template:version Please help us by advising the version of MUSHclient you are using. Use the Help menu -> About MUSHclient.


Also what operating system are you using?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Mudaddict   (8 posts)  [Biography] bio
Date Reply #5 on Sat 01 Apr 2023 06:35 AM (UTC)
Message
Version is 5.06. Running on windows 11, but have used it since Windows 7 and the ansi performance has not changed.
[Go to top] top

Posted by Mudaddict   (8 posts)  [Biography] bio
Date Reply #6 on Sat 01 Apr 2023 06:36 AM (UTC)

Amended on Sat 01 Apr 2023 06:49 AM (UTC) by Mudaddict

Message
Nick Gammon said:

I can't reproduce that. Using Fiendish's test code the client seems responsive both under Windows XP and under Ubuntu 22.04 using Wine.

Quote:

This makes my client bog all the way down when the output is in view:


You need to define that numerically. As far as I could see I could scroll up/down, and page up/down without any issues. Perhaps it is the font you are using? What font and what font size are you using for the test? I was using Fira Code.


Font is the default. I have not changed font settings. That is to say, it uses FixedSys 9pt.
To be clear, the client is perfectly responsive to input and triggers etc. What is slow is the mud text being output into the client. The text is just slow to render out into the window as compared to no ansi text.
I tried changing the font and it made no difference.

Also in case anyone was wondering if my PC is some slow POS from the 90s, no, its quite modern, intel 12th gen cpu, 32 GB ram.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Sat 01 Apr 2023 07:22 AM (UTC)
Message
Can you please make an (unlisted) YouTube video showing what you are talking about? Maybe what you think is slow, I think is fast. Or maybe there is something else going on here.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Mudaddict   (8 posts)  [Biography] bio
Date Reply #8 on Sat 01 Apr 2023 07:42 AM (UTC)

Amended on Sat 01 Apr 2023 07:57 AM (UTC) by Mudaddict

Message
Nick Gammon said:

Can you please make an (unlisted) YouTube video showing what you are talking about? Maybe what you think is slow, I think is fast. Or maybe there is something else going on here.

Here we go
https://youtu.be/GXRyY87dasU

This sample is not as bad as some fight samples. Notice that in the ansi version, the text scroll has a few hiccups while the non ansi text has only one hiccup. Its not the greatest example admittedly.

ALso it is not the network or packets. As mentioned previously, the triggers are run before i see the text that would cause the trigger. How do I know? Because I multiplay and I see the result of the trigger on the other windows (without ansi) before I see my trigger text on the ansi window.

Here is the fight scene with multiplay, notice the ansi foreground window is way slower than the background non ansi windows

https://youtu.be/XbV9aNmuIq8
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #9 on Sat 01 Apr 2023 09:47 AM (UTC)
Message
When I was playing World of Warcraft with three simultaneous windows (three connections, three clients) it tended to slow down a lot.

I'm rather impressed that you can run 19 connections in MUSHclient and still get reasonable performance.

The nature of the rendering pipeline is that it has to call ExtTextOut for each style run (ie. colour change). No doubt ExtTextOut is more efficient when processing 80 characters in one call rather than one character, because you therefore are calling it 80 times as often (even if it has to do more per call).


Still, I'll look into it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Mudaddict   (8 posts)  [Biography] bio
Date Reply #10 on Sat 01 Apr 2023 03:26 PM (UTC)
Message
Nick Gammon said:

When I was playing World of Warcraft with three simultaneous windows (three connections, three clients) it tended to slow down a lot.

I'm rather impressed that you can run 19 connections in MUSHclient and still get reasonable performance.

The nature of the rendering pipeline is that it has to call ExtTextOut for each style run (ie. colour change). No doubt ExtTextOut is more efficient when processing 80 characters in one call rather than one character, because you therefore are calling it 80 times as often (even if it has to do more per call).


Still, I'll look into it.


Appreciate this. Will remove the YT videos.
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #11 on Sun 02 Apr 2023 05:01 AM (UTC)

Amended on Sun 02 Apr 2023 05:44 AM (UTC) by Fiendish

Message
It appears to depend for me on whether the mouse cursor is hovering near the left of the output or the right (or somewhere in between). Hovering the mouse over the leftmost column shows no slowdown at all when scrolling. Moving the mouse over to the rightmost column shows significant slowdown when scrolling. I bet it's a similar issue to https://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=13688


See video capture here: https://i.imgur.com/aigMwuo.mp4
In the video my cursor starts on the left and I scroll up and down. With the cursor on the left side the scrolling performance is fine. Then I move it over to the right and scroll up and down again, and the performance tanks. Then I move the cursor back to the left side and the scroll performance is fine again.

This is with a completely stock MUSHclient 5.06 install with the exe replaced with the latest from github.
OS in my case is always weird. Wine 7.7 (crossover 22.0.1) on macOS 12.6.4.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #12 on Mon 03 Apr 2023 10:27 AM (UTC)
Message
Interesting. Well, @Mudaddict, see if the same applies to you. Does it work better with the mouse to the left of the window?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Mudaddict   (8 posts)  [Biography] bio
Date Reply #13 on Tue 04 Apr 2023 12:02 AM (UTC)
Message
Nick Gammon said:

Interesting. Well, @Mudaddict, see if the same applies to you. Does it work better with the mouse to the left of the window?


It made no difference where the cursor was, the performance was the same, slow.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #14 on Wed 05 Apr 2023 09:28 PM (UTC)
Message
OK, here is my test:


https://www.youtube.com/watch?v=B2LDAASHlYY


I put a sequence number on the left (test number). As you can see it refreshes so quickly the sequence number for the entire batch of lines just jumps from one to the other. There is no visible scrolling.

This is running version 5.06 under Windows XP.

Exact test code:


require "aardwolf_colors" -- https://raw.githubusercontent.com/fiendish/aardwolfclientpackage/MUSHclient/MUSHclient/worlds/plugins/aardwolf_colors.lua

sequence = (sequence or 0) + 1
print (string.rep ("-", 60))
ansi_string = ColoursToANSI(string.rep("@x026/@x227/@x195/@x191/@x085/", 30))
for i=1,100 do Simulate("Seq " .. sequence .. ": " .. i .. " " .. ansi_string.."\r\n") end
print (string.rep ("-", 60))

print ("Sequence", sequence)


The cursor is on the right because it is clicking the Run button. For the last couple of tests I moved the cursor over the text and hit Enter to run the test.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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,251 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]