It is currently October 15th, 2019, 7:54 pm

Snow simulator optimization [Solved]

Help with creating, editing & fixing problems with skins
User avatar
killall-q
Posts: 285
Joined: August 14th, 2009, 8:04 am

Re: Snow simulator optimization [Solved]

killall-q » December 7th, 2013, 4:56 pm

Generally, from what I observe, the number of skins you have running doesn't impact performance as much as if any one or a few of them taking up resources. Images of course take up RAM, and if you are web parsing or otherwise loading new images, or performing complex operations on images frequently, that's going to hurt performance.

None of the skins I wrote that I'm using use images, whenever possible I use fonts, and even resort to combining several characters to draw a symbol, or getting creative with lines, rectangles, circles, and arcs. (Now, if we could draw triangles... we could draw anything. Star Fox port, anyone?) Guifx v2 Transports is a great font with a minimal footprint and useful media player symbols. Not using images also allows you to be resolution agnostic.

A lower update rate never hurts, and there are a lot of skins that can get away with Update=-1, only doing anything when interacted with. That can keep CPU down a lot. IMO it's good to initially design skins using Update=5000, so that you leave out the annoying delays that can result from waiting for the skin's own updates to drive interactions. If need be, you can use WebParser's OnFinishAction with [!Update][!Redraw] at the end or a lua Initialize() function to compensate for loading delays or other complexities.
User avatar
fonpaolo
Moderator
Posts: 1343
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Snow simulator optimization [Solved]

fonpaolo » December 7th, 2013, 5:39 pm

Thanks for your reply.
It's just a curiosity, but since I'm planning of distribute my skin suite, the impact on memory usage is something I have to consider anyway, not everyone has a powerful computer with a lot of free ram.

I always use those "tricks" with WebParser and also with measures and meters, no need to update something if nothing is changed.

Most of the skins are usually hidden/minimized but being Histograms, Lines, Bars... they are always running to display the various performances of the system/hardware, but with very little impact on CPU and ram.
I have also limited the use of "Refresh" with "Update" and "Redraw" except for the setup skin and a few other commands.

Even some "animations" (thanks to jsmorley for the idea) don't have any impact on performance and memory.
User avatar
moshi
Posts: 1851
Joined: November 13th, 2012, 9:53 pm

Re: Snow simulator optimization [Solved]

moshi » December 7th, 2013, 7:12 pm

you are still thinking in Windows XP terms. you are not alone, that is why people still buy "tuning" applications to free their ram, and as an effect make their computers slower.

let me quote somebody else who has better English than me:

If you want the OS not to use your RAM, take it out of your machine and sit it on your desk. But so long as the RAM is in the machine, using it is free. If you're thinking "I want the RAM free now so I can use it later", you're being silly. You can use it now and use it later. There is no disadvantage to using the RAM. None at all.

Modern operating systems only make RAM free if they have no choice. This is because there are only two things that can happen. If the RAM is used soon, then they just have to make the RAM used again, wasting the effort they went through to make the RAM free -- it is easier to move RAM directly from one use to another. And if the RAM is not used soon, then the effort of making it free is again wasted. Making RAM free is a last resort used only if the OS has no other choice because it adds an extra step the OS will have to go through in order to use the RAM.

Free RAM is only needed for the rare cases where RAM is needed and the operating system cannot transition RAM from one use to another (for example, in interrupt context). Only a very small amount of RAM is needed for this purpose, typically 64MB or so on modern computers. Any more free RAM than that is just waste.

Consider if a program runs and then stops. The program is in RAM. The operating system could make the RAM free or it could keep the program in RAM. If the program runs again soon, keeping it in RAM is a huge win -- disk I/O is avoided. And there is zero cost to keeping the program in RAM if the RAM isn't needed for some other purpose. So the OS keeps the program in RAM until that RAM is needed for something else. Making the RAM free when free RAM isn't needed is a pure losing proposition.
User avatar
fonpaolo
Moderator
Posts: 1343
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Snow simulator optimization [Solved]

fonpaolo » December 7th, 2013, 9:24 pm

You're right, moshi, I'm still thinking in this way, but only because I don't know who will use my skins and how powerful and new is his computer, many are still using Windows XP and I know a few people still stuck with 98 S.E.

I'm not worried at all and I never thought about how much ram my skins are using, since I'm with Windows 7 64 Bit and I have a lot of ram, but 32 bit systems can only handle 4 Gb (really, a little more than 3 Gb).

I often use programs that eat a lot of ram, most of the time I use them together and I never encountered a problem or used more than half of all the available ram, usually less, a lot less.
User avatar
killall-q
Posts: 285
Joined: August 14th, 2009, 8:04 am

Re: Snow simulator optimization [Solved]

killall-q » December 7th, 2013, 10:48 pm

I agree with moshi in that on modern systems RAM usage is not an issue, least of all in Rainmeter. It is still a useful indicator of other things that can affect performance though. Think about what goes into RAM; code is miniscule, so unless there's a memory leak somewhere, if you load a skin and see a noticeable increase in RAM usage, it is being filled by files that come from somewhere. There's little performance cost once they're in RAM, that's the point of RAM; but they have to be read from your hard drive or the internet first.
User avatar
fonpaolo
Moderator
Posts: 1343
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Snow simulator optimization [Solved]

fonpaolo » December 8th, 2013, 10:40 am

The skins I have done, are made only to have a full (almost) control of system performance and resources when I use my computer heavily, if before to start to build and design all of them, I only had thought about on how much they would have had an impact on my system, I don't think I would never started. ;-)
As I said, it's only a curiosity, but also I don't want that someone claims that he can't run my skins because they slow down his old system.

I use text and lines, SolidColor and so on, when possible, but there are many things that aren't (still?) possible, as buttons or complex designs (as you said, killall-q, no triangle or sort of...), and since I'm lazy ( :D ) I use images to have complex designs, doing them with lines, circles and so on would require a neverending list of code only to display a background... :uhuh:
Obviously, this is only my opinion.
User avatar
moshi
Posts: 1851
Joined: November 13th, 2012, 9:53 pm

Re: Snow simulator optimization [Solved]

moshi » December 8th, 2013, 11:23 am

in general bitmap graphics are more performant than vectors.
there is a reason why mobile phone operating systems (where cpu/battery use really matters) and desktop operating systems' icon and theme formats are using bitmaps almost exclusively.
Apple did use PDF in the early days of OSX, they ditched that pretty fast.
User avatar
fonpaolo
Moderator
Posts: 1343
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Snow simulator optimization [Solved]

fonpaolo » December 8th, 2013, 1:00 pm

That's the reason why I still use images, even if, maybe, I spend the same amount of time to design an image with many layers, effect and other, I still prefer images instead of pure graphic generated thru Rainmeter itself.
User avatar
killall-q
Posts: 285
Joined: August 14th, 2009, 8:04 am

Re: Snow simulator optimization [Solved]

killall-q » December 8th, 2013, 5:40 pm

moshi wrote:in general bitmap graphics are more performant than vectors.
there is a reason why mobile phone operating systems (where cpu/battery use really matters) and desktop operating systems' icon and theme formats are using bitmaps almost exclusively.
Apple did use PDF in the early days of OSX, they ditched that pretty fast.
Very interesting.

Edit: I tested bitmap graphics on Snow and it does appear to improve performance slightly. It wasn't something I considered worth trying before.
User avatar
killall-q
Posts: 285
Joined: August 14th, 2009, 8:04 am

Re: Snow simulator optimization [Solved]

killall-q » December 9th, 2013, 7:20 pm

An oddity I found:

My size hack was originally a dummy image meter and the snowflakes were string meters. Then I converted the flakes to images and added a hidden string meter for something else. Today, just messing around, I removed the last string meter and it stopped working.

It seems that while the size hack can be any kind of meter, it will not work unless there is at least one string meter anywhere in the skin, even a hidden one.

Another issue is that unhiding the string meter causes a buffer overflow.

I don't like to rely on glitches to make skins to work, as they can be fixed anytime.