These are chat archives for AvaloniaUI/Avalonia

17th
Feb 2018
danwalmsley
@danwalmsley
Feb 17 2018 11:40
@grokys im going to give AvalonStudio a thourough test with the "release candidate" later on
i'll prob do it when my daughter has her afternoon nap
are you thinking of getting the custom-rx branch into the release?
Steven Kirk
@grokys
Feb 17 2018 11:57
No the custom Rx stuff won't go in the release
I think the only thing holding it up is the designer
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 12:34

@kekekeks

For our control catalog managed heap is somewhat ~35MB, runtime heap ~10MB, bitmaps ~10MB

If that were the case on the device, I would be glad :(

~/repos/skiaprojects/SkiaSharp/output/native/linux/arm$ arm-arm1176jzs-linux-gnueabi-objdump -T libSkiaSharp.so |grep -o 'GLIBC[^ ]*'|sort -n |uniq
GLIBC_2.4
GLIBC_2.7
@grokys 1/3 ?o.O
Matthijs ter Woord
@mterwoord
Feb 17 2018 12:39
@jakesays yes, hdmi for screen output, yocto-based image, controlling stuff via rs485, i2c, etc
Steven Kirk
@grokys
Feb 17 2018 13:51
@galvesribeiro actually coming up to 1/2 now! from 63,821kb to 37,723kb. however that's only managed memory
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 13:52
ok
but if it drops my memory usage in a 1/2, maybe there is light after all :D
Steven Kirk
@grokys
Feb 17 2018 13:52
still don't understand where all the unmanaged memory usage is coming from
like i say, we're really not optimized yet
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 13:53
I was about to go find some "Immediate mode" gui framework like ImGui (which has C# bindings already) or nuklear
Steven Kirk
@grokys
Feb 17 2018 13:53
there's still a lot we can do, it's just a matter of priorities between features and speed
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 13:53
yeah I know
Steven Kirk
@grokys
Feb 17 2018 13:53
you can actually go immediate mode on avalonia
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 13:54
but that doesn't matter if all the rest of the framework is consuming that much of memory
those 2 cases they are extremly lightweight
Steven Kirk
@grokys
Feb 17 2018 13:54
nope. it really is too much.
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 13:55
there is no state management, binding, events etc... they are pretty simple
of course, that comes with downsides
Steven Kirk
@grokys
Feb 17 2018 13:55
i'd be interested to see actually if the custom-rx branch did make any difference for you
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 13:55
:)
Steven Kirk
@grokys
Feb 17 2018 13:55
yes, tbh on such a limited memory device you may be better with a framework like that
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 13:55
I'll give it a try when I get back home. Out to lunch with my wife otherwise I'll be killed
Steven Kirk
@grokys
Feb 17 2018 13:55
i'd like for us to be usable on such devices
but we've still got a long way to go
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 13:55
to give you an idea
Steven Kirk
@grokys
Feb 17 2018 13:56
haha sure
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 13:56
I have a port of WebKit EFL running on the device with ReactJS or InfernoJS app on it
and it run with 36-40mb ram
the codebase of webkit is 1.1gb, just to give an idea
Steven Kirk
@grokys
Feb 17 2018 13:57
yes that's where we need to get to
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 13:59
so
I never got to the intriscics of Avalonia source to understand how it work so I could point out sume suggestions on optimizations or at least things that could be disabled that isn't interesting on a embedded device
Steven Kirk
@grokys
Feb 17 2018 14:01
i think the first thing to understand is where all that memory usage is coming from on linux
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:02
on my device I can't run the profile unfortunatelly
Steven Kirk
@grokys
Feb 17 2018 14:02
@kekekeks
For our control catalog managed heap is somewhat ~35MB, runtime heap ~10MB, bitmaps ~10MB
I have no idea what occupies the rest
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:02
maybe when my PIs arrive I would
Steven Kirk
@grokys
Feb 17 2018 14:02
so according to that message it's the same on linux
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:02
I believe 55mb still usable for me
I have 64mb
161mb, is unreasonable
Steven Kirk
@grokys
Feb 17 2018 14:03
remember that is without the savings in custom-rx
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:03
even if I consider the OS paging to disk, I would have 128mb total memory
Steven Kirk
@grokys
Feb 17 2018 14:03
but kekekkes was saying that memory usage on linux is around 161mb
but he can only account for 55
we don't understand what the other ~100mb is
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:04
yeah... neither do I
out of curiosity... does all this reactive stuff create a bunch of threads? or does it stick with the single Avalonia render thread?
Steven Kirk
@grokys
Feb 17 2018 14:05
reactive stuff doesn't create threads unless you tell it to
and we don't tell it to
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:05
ok good
Steven Kirk
@grokys
Feb 17 2018 14:05
so no, by default there should only be 2 threads: UI thread and render thread
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:05
ok
that is ok
Steven Kirk
@grokys
Feb 17 2018 14:06
if you don't want the UI thread you can use the immediate renderer
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:06
my device is single core
so having bunch of threads is not an option on it
Nikita Tsukanov
@kekekeks
Feb 17 2018 14:08
Hmmm
изображение.png
Somehow it's down to 59 MB on the latest master
118M RES though
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:12
118mb of resources?
Nikita Tsukanov
@kekekeks
Feb 17 2018 14:13
total amount of memory
gnome monitor shows RES - SHR
SHR = memory shared between multiple processes
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:14
Ok
Nikita Tsukanov
@kekekeks
Feb 17 2018 14:14
There is currently only one dotnet process running, so it's the system libraries
Including GTK, Skia, etc
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:14
Ok
But inmy case, I did a test with Skia+mono+console app
And it ended up with 29mb
Nikita Tsukanov
@kekekeks
Feb 17 2018 14:15
GC Heap Size: Size: 0x1191588 (18421128) bytes.
EE heap - Total size: Size: 0x8b0000 (9109504) bytes.
So it's 18MB of managed memory
and 9MB of EE heap (jitted code, etc)
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:17
Out of curiosity, is Skia backend reusing the same canvas/bitmap? Or is it creating a new one for every draw?
(On mobile) my test was something like:
Nikita Tsukanov
@kekekeks
Feb 17 2018 14:20
Also 600KB of unmanaged bitmap data

Skia backend reusing the same canvas/bitmap

we are allocating a new one each time manually

using mmap call
It's also manually disposed
So there is no resource leak there
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:21
Var canvas = surface.Canvas; // surface created from FB
using( var bmp = ...)
{
while(true) { //loop and draw forever }
}
Steven Kirk
@grokys
Feb 17 2018 14:21
@kekekeks does the designer work for you on AvaloniaUI/AvaloniaVS#57 after creating a new project?
Nikita Tsukanov
@kekekeks
Feb 17 2018 14:22
Basically, we have 27MB of managed+runtime heap and 600 KB of bitmap data. That's for the screenshot above
@grokys let me try
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:22
Ok, so where does all the other 140mb comes from? :smile:
Nikita Tsukanov
@kekekeks
Feb 17 2018 14:23
The problem is that I have no idea what occupies the rest of 59MB (RES-SHR)
We are missing ~30MB somewhere
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:23
Skia?
Nikita Tsukanov
@kekekeks
Feb 17 2018 14:23
No idea
It shouldn't allocate anything
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:24
Just itself
Which in my case is around 3mb
Nikita Tsukanov
@kekekeks
Feb 17 2018 14:24
It might be worth to implement "headless" platforms for windowing/drawing
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:24
Yours is probably bigger as the default skisharp build is big and mine is capped of unecessary stuff
Nikita Tsukanov
@kekekeks
Feb 17 2018 14:25
So we can see the footprint of Avalonia itself and particular platform backends separately
Matthijs ter Woord
@mterwoord
Feb 17 2018 14:25
@kekekeks have you trioed the perf stuff in that link i just sent?
supposedly can take mem snapshots and analyze them with that
on linux
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:26
Isnt that what what fb backend does @kekekeks
?
Nikita Tsukanov
@kekekeks
Feb 17 2018 14:26
BTW, @grokys calendar is a huge resource hog, when I open calendar page memory usage skyrockets
Steven Kirk
@grokys
Feb 17 2018 14:27
yeah
Nikita Tsukanov
@kekekeks
Feb 17 2018 14:27
@mterwoord our managed memory consumption is completely fine
We won't get any information from these memory snapshots
Steven Kirk
@grokys
Feb 17 2018 14:27
i see calendar as a test case right now for how far we've got to go
Matthijs ter Woord
@mterwoord
Feb 17 2018 14:27
ah, o. sorry. missed that
Nikita Tsukanov
@kekekeks
Feb 17 2018 14:28
I can already see managed memory consumption per-object using lldb with sos plugin
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:28
How complicated would be to me to bring back from the death Cairo backend to framebuffer support?
Nikita Tsukanov
@kekekeks
Feb 17 2018 14:29
If you can teach it to support ILockedFramebuffer
It should work
But I don't think that we'll be supporting it in the main repo
It has too many issues
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:30
I’m saying that because even problematic and old, cairo is very lightweight if compared to skia
I know, but that would be only useful for framebuffer scenario
All the other platforms it isnt necessary
Cairo is just fine to draw bitmaps specially if you are using framebuffer
I mean, I would like to discard the possibility that skia and its deps are screwing everything up
Nikita Tsukanov
@kekekeks
Feb 17 2018 14:35
Memory consumption was roughly the same for Cairo
when I was comparing them last time
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:36
Managed memory, right?
What about the native one?
Nikita Tsukanov
@kekekeks
Feb 17 2018 14:36
total memory
Gutemberg Ribeiro
@galvesribeiro
Feb 17 2018 14:36
Humm
Nikita Tsukanov
@kekekeks
Feb 17 2018 14:40
@grokys designer doesn't work because of outdated nuget packages
Steven Kirk
@grokys
Feb 17 2018 14:40
ahhh
Nikita Tsukanov
@kekekeks
Feb 17 2018 14:41
After upgrading to build4554-alpha it works fine
Steven Kirk
@grokys
Feb 17 2018 14:41
ok cool
should have thought of that
Nikita Tsukanov
@kekekeks
Feb 17 2018 14:41
I need to figure out why exceptions aren't appended to stdout
stderr, I mean
Steven Kirk
@grokys
Feb 17 2018 14:41
ok i'll give designer a bit more of a test and when you're happy with it i think we can release?
danwalmsley
@danwalmsley
Feb 17 2018 14:48
@grokys ok so current master is pretty much how beta 1 will be so I should test against that?
Il let you know how custom rx affects memory usage on Windows and Linux too
Steven Kirk
@grokys
Feb 17 2018 14:51
yep, hopefully current master will become beta with a version bump
Nikita Tsukanov
@kekekeks
Feb 17 2018 14:53
I've updated VS extension so it should show crashed process output properly
Steven Kirk
@grokys
Feb 17 2018 17:41
@kekekeks i've updated the nuget package version and the designer kinda works now, but it's just showing a blank page when I create a new MVVM application
if i change the binding to actual text then it shows the text
but it doesn't seem to be picking up the binding to the view model
am i setting everything up ok?
danwalmsley
@danwalmsley
Feb 17 2018 17:59
@grokys ok master on windows with skia backend is good
going to check direct 2d
direct2d on windows also looks good
just noticed this issue with treeview
image.png
see left hand side of image, its not deselecting items correctly
but probably that can be fixed after release its not a biggy
Steven Kirk
@grokys
Feb 17 2018 18:04
hmm that's strange about the treeview
can't repro here
ok, sounds like we're good to go with that version
danwalmsley
@danwalmsley
Feb 17 2018 18:04
do you have it bound to a vm or just items declared in xaml
Steven Kirk
@grokys
Feb 17 2018 18:04
only thing is the designer not showing bindings
we can always fix that later i guess
danwalmsley
@danwalmsley
Feb 17 2018 18:05
if you give me 10 minutes il have chance to test on Ubuntu too
Steven Kirk
@grokys
Feb 17 2018 18:05
ok, will try to do a release hopefully this evening or maybe tomorrow depending on life stuff
danwalmsley
@danwalmsley
Feb 17 2018 18:05
just incase
ok cool,
i thought you were literally gonna press the button
just now
Steven Kirk
@grokys
Feb 17 2018 18:14
no, i still need to finish off the release notes
danwalmsley
@danwalmsley
Feb 17 2018 18:24
ok ubuntu with skia also looks good
@grokys that treeview issue is this
AvaloniaUI/Avalonia#1326
Steven Kirk
@grokys
Feb 17 2018 18:26
ah yeah, i've not been able to repro that either (though I've not had time to try that hard)
danwalmsley
@danwalmsley
Feb 17 2018 18:26
iv suggested a trivial fix, that seems to work, but no idea on the knock on effects fix might have, @jkoritzinsky tried a different fix at the time the issue was filed, which didnt work
yeah I noticed ControlCatalog didnt show the issue
Steven Kirk
@grokys
Feb 17 2018 18:27
wonder what the difference is in use-cases
danwalmsley
@danwalmsley
Feb 17 2018 18:27
yeah
perhaps in combination with templates
only major difference I can think of is databinding
ill try and do a repro eventually
ok so here is AS memory usage on ubuntu on current master
image.png
danwalmsley
@danwalmsley
Feb 17 2018 18:55
@grokys AvaloniaPropertyChangedEventArgs OldValue and NewValue have lost their types (they are just objects now) is this by design?
on the custom-rx branch
Steven Kirk
@grokys
Feb 17 2018 18:59
ah no, that's definitely not by design!
oh hold on
you mean the properties are typed object?
danwalmsley
@danwalmsley
Feb 17 2018 19:01
hmm
(I was using GetObservableWithHistory) iv assumed this is the new method?
Steven Kirk
@grokys
Feb 17 2018 19:07
ah yeah i removed that method and replaced it with https://github.com/AvaloniaUI/Avalonia/blob/custom-rx/src/Avalonia.Base/AvaloniaObjectExtensions.cs#L82 which as you say is untyped
i should probably put it back
i just don't like the name ;)
danwalmsley
@danwalmsley
Feb 17 2018 19:13
Yeah name is better now
If you could put a commit quickly to revert the name, it will allow me to test As really quickly
Steven Kirk
@grokys
Feb 17 2018 19:13
ok let me add it back in
danwalmsley
@danwalmsley
Feb 17 2018 19:14
At the moment I'm having to recompile dependencies like docknc based of Avalonia as getting missing method exceptions
Steven Kirk
@grokys
Feb 17 2018 19:15
because that method was removed? yeah it's not a good idea to remove a method like that without at least depreciating it first!
ok @danwalmsley done
danwalmsley
@danwalmsley
Feb 17 2018 19:18
Ok will try now
So the method is back with new behavior or old behavior?
Steven Kirk
@grokys
Feb 17 2018 19:19
back with old behavior
danwalmsley
@danwalmsley
Feb 17 2018 19:19
Ok
Steven Kirk
@grokys
Feb 17 2018 19:19
(hopefully, didn't actually test it!)
danwalmsley
@danwalmsley
Feb 17 2018 19:19
It wouldn't be a major source of memory usage that method?
Steven Kirk
@grokys
Feb 17 2018 19:19
not sure, depends how often you use it probably
danwalmsley
@danwalmsley
Feb 17 2018 19:20
Ok
Steven Kirk
@grokys
Feb 17 2018 19:20
the way i just re-implemented it uses an rx Select which is the sort of thing i'm trying to avoid in that branch
as rx operators use a lot of memory
danwalmsley
@danwalmsley
Feb 17 2018 19:20
It's only to help me show you memory usage without taking an hour of recompiling stuff
Steven Kirk
@grokys
Feb 17 2018 19:21
yeah
danwalmsley
@danwalmsley
Feb 17 2018 19:23
you should probably get rid of the method though, force us all to upgrade, but i suppose if it gets into Beta-1 you will want to depricate it first
Steven Kirk
@grokys
Feb 17 2018 19:23
yup, definitely
it's behavior is rather unusual because it doesn't push the current value of the property first, whereas GetObservable does
so it could be confusing
GetPropertyChangedObservable is a bit more descriptive
but untyped...
danwalmsley
@danwalmsley
Feb 17 2018 19:25
almost there
just compiling AS now
so would you expect a dramatic change in ram usage now?
Steven Kirk
@grokys
Feb 17 2018 19:26
hopefully! though on linux it seems that most of the memory usage is non-managed at the moment, so who knows
danwalmsley
@danwalmsley
Feb 17 2018 19:28
image.png
so RES column
went down from 264 to 256
Steven Kirk
@grokys
Feb 17 2018 19:29
oh. that's pretty disappointing
though if a small amount of that memory is managed i guess it's expected
danwalmsley
@danwalmsley
Feb 17 2018 19:30
yeh
and that was opening a file, and proje t
Steven Kirk
@grokys
Feb 17 2018 19:30
any way to check managed memory usage?
danwalmsley
@danwalmsley
Feb 17 2018 19:31
if I just run the IDE and do nothing only load
its
167mb down to 156mb
hmm I guess that will need some kind of .net profiling tool
let me see
no idea how to find out, and nothing obvious is coming up on goolg
linux is using way more memory than windows
its only 80mb on windows
(on master)
Steven Kirk
@grokys
Feb 17 2018 19:38
what's the custom-rx branch using on windows?
i'd be interested to see the results from the VS diagnostic tools too
danwalmsley
@danwalmsley
Feb 17 2018 19:43
Il need a little more time to tell. You
It's Bath time. For little one now!!!
Steven Kirk
@grokys
Feb 17 2018 19:47
haha enjoy!
Nikita Tsukanov
@kekekeks
Feb 17 2018 21:21
@grokys how is designer supposed to know the data context?
You need to specify it via Design.DataContext property
We probably need to somehow add support for d:DataContext and mc:Ignorable
Steven Kirk
@grokys
Feb 17 2018 21:40
Ahhh ok yeah that makes sense
I probably should set that property in the template then
Nikita Tsukanov
@kekekeks
Feb 17 2018 21:57
Design.DataContext="{x:Static local:MyApp.MyViewModel.DesignInstance}"
something like that