It is currently March 29th, 2024, 6:48 am

BUG: Massive performance cost for 2 image and string meters

Report bugs with the Rainmeter application and suggest features.
coldshiver
Posts: 9
Joined: January 8th, 2014, 4:06 am

BUG: Massive performance cost for 2 image and string meters

Post by coldshiver »

An empty Rainmeter skin with only 2 image meters and 1 string meter is using up massive resources in CPU and GPU.

This skin uses about 20% CPU on my Ryzen 7 2700X (eight core) processor.
This skin uses about 30% GPU on my Nvidia 1080ti.

The demonstration project is attached.

Observations:
  1. When only commenting out the empty string meter in the bottom of the skin ini, performance returns to normal.
  2. When only commenting out the image meters in the skin ini, performance returns to normal.
  3. This suggests image meter together with string meter is conflicting with each other somehow causing perhaps lots of redraws.
  4. Issue present in both latest final and beta versions of rainmeter now (4.3.1 Final Release - r3321 and 4.4 Beta Release - r3338)
  5. Hardware acceleration should be turned off, when it is enabled it will hide the issue mostly although total system gpu(not specifically rainmeter proces) usage for me was still about 14% whenever the skin was loaded, still very high. In any case it is weird when hardware accleration is off doing point 1 and 2 makes such a difference on performance.


Note that the specific image used in this skin is costing more performance than other images i have tried so far, but this just means it better illustrates the issue and makes it more obvious to debug.

During developing another skin that uses 10 images and string meters i encountered this issue first and noticed my skin was using 70% cpu and 80% gpu, giving my gaming rig a run for it's money. So this issue stacks up quickly and ramps up total utilization of your system quickly. I then stripped out everything down to the minimum to illustrate this issue and thus my static skin was made.


Turns out there was an invisible character in the skin ini file causing updates every millisecond instead of 1000. Thanks for everyone's help in investigating.
See posts below :oops:
You do not have the required permissions to view the files attached to this post.
Last edited by coldshiver on April 8th, 2020, 8:09 pm, edited 4 times in total.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: BUG: Massive performance cost for 2 image and string meters

Post by mak_kawa »

I don't oppose to you, but honestly I can't notice the CPU/GPU resource hog as you said. Just reporting.

I loaded your ImagesWithTextMetersPerformanceCostDemonstration.ini and image file as it is. Value of the CPU usage of the Rainmeter process is 3.0-5.6 %, and when unloaded, 3.1-5.2 %, GPU usage is 0.0-6.0 %, and when unloaded 0.0-5.0 %. So, practically no change.

My PC spec is...CPU: Intel i7-2600 (max.3.4GHz 4 cores) and Radeon RX550 GPU. Old-fashioned and low-performance PC.

I am not sure why CPU/GPU usages are so high in your PC and Rainmeter.
coldshiver
Posts: 9
Joined: January 8th, 2014, 4:06 am

Re: BUG: Massive performance cost for 2 image and string meters

Post by coldshiver »

mak_kawa wrote: April 5th, 2020, 12:32 pm I don't oppose to you, but honestly I can't notice the CPU/GPU resource hog as you said. Just reporting.

I loaded your ImagesWithTextMetersPerformanceCostDemonstration.ini and image file as it is. Value of the CPU usage of the Rainmeter process is 3.0-5.6 %, and when unloaded, 3.1-5.2 %, GPU usage is 0.0-6.0 %, and when unloaded 0.0-5.0 %. So, practically no change.

My PC spec is...CPU: Intel i7-2600 (max.3.4GHz 4 cores) and Radeon RX550 GPU. Old-fashioned and low-performance PC.

I am not sure why CPU/GPU usages are so high in your PC and Rainmeter.
Did you also disable hardware acceleration to make the effect more noticable?
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: BUG: Massive performance cost for 2 image and string meters

Post by mak_kawa »

I have missed hardware acceleration on/off. With the acceleration off, CPU usage of Rainmeter process is 25-42 % as you said, but no change in GPU usage.
User avatar
Jeff
Posts: 326
Joined: September 3rd, 2018, 11:18 am

Re: BUG: Massive performance cost for 2 image and string meters

Post by Jeff »

Code: Select all

[style]
H=250
PreserveAspectRatio=1
ImageName=#CURRENTPATH#images/2019-11-15-jedifallenorder.jpg

[Meter1Image]
Meter=IMAGE
MeterStyle=Style
Group=1
x=50

[Meter2Image]
Meter=IMAGE
MeterStyle=Style
Group=2
x=500
coding it like this fixed the problem for me
without compiling rainmeter and seeing the debug profiler i really don't know what the problem is
it may be that horrible MeterStyle=Meter1Image, since it's creating a loop and it keeps applying the meter option of the style
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: BUG: Massive performance cost for 2 image and string meters

Post by jsmorley »

There is no loop created by the Meter=Image option of the MeterStyle. That is just ignored in any style, since it explicitly can't be part of a style. It is possible that the style is causing an issue with the W and H "resizing" of the image(s), but I'm not sure right off. There is no "loop" or "self-reference" in his code, and a functional meter can certainly be used as a MeterStyle for another functional meter, that's not the problem.

The only things that are being "inherited" by Meter2Image from Meter1Image are:

H=250
PreserveAspectRatio=1

I don't see that as any problem. But for some reason it seems like it might be.

Something is causing it to get it's knickers in a knot during the "redraw" portion of the cycle, but we will have to dig into it a bit.

If you have code like this:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]

[Meter1]
Meter=String
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Hello

[Meter2]
;Meter=String
MeterStyle=Meter1
Text=World
Then [Meter2] is just entirely ignored. It has no Meter= option defined on it, and so in effect doesn't exist as a meter. It simply can't inherit Meter=String from [Meter1]. MeterStyle doesn't allow that.
User avatar
Brian
Developer
Posts: 2674
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: BUG: Massive performance cost for 2 image and string meters

Post by Brian »

This isn't a bug, but an invisible character problem. Similar to the one reported here: https://forum.rainmeter.net/viewtopic.php?f=5&t=34782

There is a hidden character 20 2D between the = and the 1000 in your Update option. Although you cannot see it, Rainmeter does, but cannot intrepret that character, so it assumes 0 - essentially making the skin constantly update.

The character 20 2D is the "Left to Right Override". Not sure how it got in your code.
http://www.fileformat.info/info/unicode/char/202d/index.htm
Forum.InvisibleChar.1.png
You can test this in any text editor by moving the cursor with the keyboard over the Update option. You will see it "not move" between the = and 1000.

-Brian
You do not have the required permissions to view the files attached to this post.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: BUG: Massive performance cost for 2 image and string meters

Post by mak_kawa »

Amazing consequence...
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: BUG: Massive performance cost for 2 image and string meters

Post by jsmorley »

Brian wrote: April 7th, 2020, 10:15 pm This isn't a bug, but an invisible character problem. Similar to the one reported here: https://forum.rainmeter.net/viewtopic.php?f=5&t=34782

There is a hidden character 20 2D between the = and the 1000 in your Update option. Although you cannot see it, Rainmeter does, but cannot intrepret that character, so it assumes 0 - essentially making the skin constantly update.

The character 20 2D is the "Left to Right Override". Not sure how it got in your code.
http://www.fileformat.info/info/unicode/char/202d/index.htm

Forum.InvisibleChar.1.png

You can test this in any text editor by moving the cursor with the keyboard over the Update option. You will see it "not move" between the = and 1000.

-Brian
That was also the very first thing I thought of! 😜

User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: BUG: Massive performance cost for 2 image and string meters

Post by eclectic-tech »

Brian wrote: April 7th, 2020, 10:15 pm This isn't a bug, but an invisible character problem. Similar to the one reported here: https://forum.rainmeter.net/viewtopic.php?f=5&t=34782...
-Brian
Only a "real" coder would look for an invisible character! :p
Besides resizing 2 almost full screen height image to 250 pixels high every second; which is also CPU intensive... :uhuh:
Nice catch! :great: