aelyo-softworks / Wice

Windows Interface Composition Engine is a .NET C# UI engine for creating Windows application.
Other
107 stars 5 forks source link

New WiceCore.Samples.Gallery use too much Memory #10

Closed sgf closed 3 months ago

sgf commented 3 months ago

old Wice.Samples.Gallery.exe old max memory useage=50mb but new WiceCore.Samples.Gallery.zip max memory useage =170mb

and the Microsoft.Windows.SDK.NET.dll too big

If possible, can it be made more modular and the size reduced to less than 1mb? After all, the zip looks obviously does not carry a .net runtime.

I believe that they must have carried most of the il code that not need be executed.

smourier commented 3 months ago

About memory usage, I see around 50M for the .NET Framework (note it's not "old", it just targets another version of .NET) version, and around 70-80M for the .NET Core version, but this is unrelated to the size of binaries, it's managed by .NET.

As for Microsoft.Windows.SDK.NET.dll it comes from .NET core so there's nothing I can do about that.

I have no plan for making this modular, you can try to trim the code or use AOT (.NET 8) but I don't think it will work as it uses lots of interop and many scenarios are unsupported with this. But it certainly won't fit in 1Mb anyway

sgf commented 3 months ago

About memory usage, I see around 50M for the .NET Framework (note it's not "old", it just targets another version of .NET) version, and around 70-80M for the .NET Core version, but this is unrelated to the size of binaries, it's managed by .NET.

As for Microsoft.Windows.SDK.NET.dll it comes from .NET core so there's nothing I can do about that.

I have no plan for making this modular, you can try to trim the code or use AOT (.NET 8) but I don't think it will work as it uses lots of interop and many scenarios are unsupported with this. But it certainly won't fit in 1Mb anyway

If you click on the tab page on the left, you will find that the memory usage of the core version will immediately increase. If you click a few more, it will immediately exceed 100.

But we know that this is just a pure demonstration and does not even have real complex business logic code inside.

Charltsing commented 3 months ago

1

smourier commented 3 months ago

About memory usage, I see around 50M for the .NET Framework (note it's not "old", it just targets another version of .NET) version, and around 70-80M for the .NET Core version, but this is unrelated to the size of binaries, it's managed by .NET. As for Microsoft.Windows.SDK.NET.dll it comes from .NET core so there's nothing I can do about that. I have no plan for making this modular, you can try to trim the code or use AOT (.NET 8) but I don't think it will work as it uses lots of interop and many scenarios are unsupported with this. But it certainly won't fit in 1Mb anyway

If you click on the tab page on the left, you will find that the memory usage of the core version will immediately increase. If you click a few more, it will immediately exceed 100.

But we know that this is just a pure demonstration and does not even have real complex business logic code inside.

I don't know what "tab page on the left" you're talking about but this is what I see with WiceCore gallery after having clicked all around in the app. As for "real complex business logic code", this is not necessarily what takes memory.

image

sgf commented 3 months ago

动画07 and mouse select has some bug on left tab(Or Menu)

sgf commented 3 months ago

动画08 When the mouse wheel scrolls down, the content page moves down very slowly.

sgf commented 3 months ago

动画09 mouse characters select postion has some problem and double click cant auto select full-word

smourier commented 3 months ago

Ok, but I don't see memory usage like you do. It may be dependent on your system.

As for the mouse wheel, this is how it works, you can speed it up using SHIFT while you're moving the mouse. You can also change the code if you don't like it: https://github.com/aelyo-softworks/Wice/blob/main/Wice/ScrollViewer.cs#L526

As for the rest, I don't see "bugs", clicking on a text (which can also be a button) can also select it. This is how it works today but again, you can change the code if you want.

PS: please don't post about multiple subjects in the same github issue.

sgf commented 3 months ago

at last gif,(mouse characters select postion has some problem)

Haven't you noticed that the position of the selected character is always behind the starting point where the mouse pointer falls (1-2 letters)?

sgf commented 3 months ago

"and mouse select has some bug on left tab(Or Menu)"

Didn't you notice that when switching to the "Collections" tab (Or Menu), the animation is displayed I clicked multiple times, but the "Collections" menu did not switch successfully? When I moved the mouse slightly and clicked again, I successfully switched to the new menu.

sgf commented 3 months ago

As for the memory usage, I tried to click on all the features. Since the complete gif is too large and requires 99mb, I reduced its size.

smourier commented 3 months ago

at last gif,(mouse characters select postion has some problem)

Haven't you noticed that the position of the selected character is always behind the starting point where the mouse pointer falls (1-2 letters)?

Ok I've fixed this one in the last commit https://github.com/aelyo-softworks/Wice/commit/c38e6771bf8a88f146529fdd7884966353989682#

smourier commented 3 months ago

"and mouse select has some bug on left tab(Or Menu)"

Didn't you notice that when switching to the "Collections" tab (Or Menu), the animation is displayed I clicked multiple times, but the "Collections" menu did not switch successfully? When I moved the mouse slightly and clicked again, I successfully switched to the new menu.

Not sure exactly what your problem is but I think you're clicking on the tooltip which doesn't click through.

sgf commented 3 months ago

"and mouse select has some bug on left tab(Or Menu)" Didn't you notice that when switching to the "Collections" tab (Or Menu), the animation is displayed I clicked multiple times, but the "Collections" menu did not switch successfully? When I moved the mouse slightly and clicked again, I successfully switched to the new menu.

Not sure exactly what your problem is but I think you're clicking on the tooltip which doesn't click through.

Each yellow flash represents a click. I re-edited the animation. This is an occasional bug. It does not trigger every switch. But it will affect the experience.

动画10

smourier commented 3 months ago

Yes, it's because the click happens on the tooltip window (you can see the cursor is not the hand when it doesn't work). You can change the code so the tooltip window (borders are invisible) sticks closer to its content changing its padding here : https://github.com/aelyo-softworks/Wice/blob/main/Wice/ToolTip.cs#L25 (by default it's 8).

However, I've added a click through feature that now makes clicks on tooltip click through the underlying window https://github.com/aelyo-softworks/Wice/commit/cbb860eb9ffeabcc07cb1044b402b3eae9399e8a so there's no issue like that anymore.

sgf commented 3 months ago

动画12

I re-animated the memory usage and it seems to be related to the "Is Mouse In Pointer Enable" function feature

smourier commented 3 months ago

Yes, it's because this setting generates WM_POINTERxxx message, to be added to the usual mouse messages (which in turns will possibly activate actions and transform the visual tree), so it causes more memory allocations when you move a mouse that will go away when GC runs (in debug builds you press F11 which calls GC.Collect()). The effect is quite attenuated in release builds.