These are chat archives for AvaloniaUI/Avalonia

9th
Jun 2017
Matthijs ter Woord
@mterwoord
Jun 09 2017 06:00
@kekekeks @soerendd it doesn't work yet with avalonia.. still working on that
i think x11 underneath
regarding docker image, problem is that right now i need a raspberry to compile against (headers)
Nikita Tsukanov
@kekekeks
Jun 09 2017 08:58
@grokys Why not just use HashSet<T> and OrderedSet<T>?
One for checking for duplicates, another one for ordering
Since visuals are reference types, storing them 2 times should be relatively cheap
Matthijs ter Woord
@mterwoord
Jun 09 2017 09:00
on .net, references are 16 or 32 bytes iirc
object references that is
Nikita Tsukanov
@kekekeks
Jun 09 2017 09:00
Same size as IntPtr, actually
Matthijs ter Woord
@mterwoord
Jun 09 2017 09:01
?
sure on that?
Nikita Tsukanov
@kekekeks
Jun 09 2017 09:01
they are pointers after all
Matthijs ter Woord
@mterwoord
Jun 09 2017 09:01
no, they are handles.
Nikita Tsukanov
@kekekeks
Jun 09 2017 09:01
But the point is that there is no reason to write highly optimized implementation right now, if we could combine existing ones and get the same behavior.
Matthijs ter Woord
@mterwoord
Jun 09 2017 09:02
true
Nikita Tsukanov
@kekekeks
Jun 09 2017 09:02
And if it proves to be slow, then we could create a custom one
If we won't change our mind about requirements at that point
Fake it until you make it
Steven Kirk
@grokys
Jun 09 2017 09:15
@kekekeks OrderedSet<T>?
Nikita Tsukanov
@kekekeks
Jun 09 2017 09:15
SortedSet<T>
Steven Kirk
@grokys
Jun 09 2017 09:16
doesn't allow duplicates - so you can only have 1 control at say distance 3 from the root - not so good ;)
Nikita Tsukanov
@kekekeks
Jun 09 2017 09:20
System.Collections.SortedList then, I guess
Hm
Also implements dictionary
Nikita Tsukanov
@kekekeks
Jun 09 2017 09:27
Well, SortedList<int, List<IVisual>> might solve the problem
Steven Kirk
@grokys
Jun 09 2017 09:30
that's what i have now
it's not ideal though
Matthijs ter Woord
@mterwoord
Jun 09 2017 09:30
and why do you want to change into something?
Steven Kirk
@grokys
Jun 09 2017 09:31
i don't want to change into anything @mterwoord
:P
Matthijs ter Woord
@mterwoord
Jun 09 2017 09:31
why is it not ideal?
Steven Kirk
@grokys
Jun 09 2017 09:32
mainly because there's a lot more allocations than need be
this is code that will be called many times per frame, the less allocations the best
Matthijs ter Woord
@mterwoord
Jun 09 2017 09:33
does the list get built from scratch each time?
list/dictionary/whatever
Steven Kirk
@grokys
Jun 09 2017 09:35
yeah, that's another problem: the deallocation strategy is either restart from scratch each time, or leave loads of potentially empty lists lying around
Matthijs ter Woord
@mterwoord
Jun 09 2017 09:36
hmm, and do a cleanup run every now and then?
Steven Kirk
@grokys
Jun 09 2017 09:37
yeah, but then it gets complicated... a some sort of BST woul bypass those problems
Matthijs ter Woord
@mterwoord
Jun 09 2017 09:37
bsp/
?
Steven Kirk
@grokys
Jun 09 2017 09:38
BST sorry, binary search tree
Nikita Tsukanov
@kekekeks
Jun 09 2017 09:38
mainly because there's a lot more allocations than need be
Wiesław Šoltés
@wieslawsoltes
Jun 09 2017 09:38
@grokys Would use of ImmutableList help ?
Nikita Tsukanov
@kekekeks
Jun 09 2017 09:38
Actually there won't be many allocations
Wiesław Šoltés
@wieslawsoltes
Jun 09 2017 09:38
Its a struct
Nikita Tsukanov
@kekekeks
Jun 09 2017 09:38
After initial list population
I think that we can even get away with List<List<IVisual>>
Matthijs ter Woord
@mterwoord
Jun 09 2017 09:39
inserting/removing from list (except for end) causes a lot of memory traffic
Nikita Tsukanov
@kekekeks
Jun 09 2017 09:39
Once lists allocate capacity they won't drop it
So after initial population all data structures won't allocate anything unless lists need to grow
Matthijs ter Woord
@mterwoord
Jun 09 2017 09:40
removing items from lists can be very expensive..
Nikita Tsukanov
@kekekeks
Jun 09 2017 09:40
Mkay, List<Queue<IVisual>> then
Matthijs ter Woord
@mterwoord
Jun 09 2017 09:40
or linkedlist..
Nikita Tsukanov
@kekekeks
Jun 09 2017 09:40
bad idea, tons of allocations
Matthijs ter Woord
@mterwoord
Jun 09 2017 09:40
ok
Steven Kirk
@grokys
Jun 09 2017 09:41
yeah, List<Queue<IVisual>> might be the best idea using inbuilt collections
Nikita Tsukanov
@kekekeks
Jun 09 2017 09:41
The problem is what to do when distance from root is changed
Steven Kirk
@grokys
Jun 09 2017 09:41
that shouldn't be a problem - the control can be removed and re-added
ah with queue
yeah
Nikita Tsukanov
@kekekeks
Jun 09 2017 09:42
Well, we need a way to efficiently find corresponding queue
Matthijs ter Woord
@mterwoord
Jun 09 2017 09:42
there's no unique id?
Nikita Tsukanov
@kekekeks
Jun 09 2017 09:42
But I guess that cached distance from root is still available in DetachedFromVisualTree
so it should be fine
Denis Podgorodnichenko
@qadmium
Jun 09 2017 09:43
Hi guy! I have a trouble with installing avalonia vsix package09.06.2017 12:39:03 - Supported Products : 09.06.2017 12:39:03 - Microsoft.VisualStudio.Community 09.06.2017 12:39:03 - Version : [15.0] 09.06.2017 12:39:03 - 09.06.2017 12:39:03 - References : 09.06.2017 12:39:03 - ------------------------------------------------------- 09.06.2017 12:39:03 - Identifier : Microsoft.VisualStudio.MPF.15.0 09.06.2017 12:39:03 - Name : Visual Studio MPF 15.0 09.06.2017 12:39:03 - Version : [15.0,16.0) 09.06.2017 12:39:03 - MoreInfoURL : 09.06.2017 12:39:03 - Nested : No 09.06.2017 12:39:03 - 09.06.2017 12:39:03 - Signature Details... 09.06.2017 12:39:03 - Extension is not signed. 09.06.2017 12:39:03 - 09.06.2017 12:39:03 - Searching for applicable products... 09.06.2017 12:39:03 - Found installed product - Microsoft Visual Studio Community 2015 09.06.2017 12:39:03 - Found installed product - Microsoft Visual Studio 2015 Shell (Integrated) 09.06.2017 12:39:03 - Found installed product - Global Location 09.06.2017 12:39:03 - VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.
this is my log, can anyone explain me whats wrong?
Nikita Tsukanov
@kekekeks
Jun 09 2017 09:43
You need VS2017 for extension from VSGallery
Denis Podgorodnichenko
@qadmium
Jun 09 2017 09:43
is it works with VS2015?
Nikita Tsukanov
@kekekeks
Jun 09 2017 09:43
Old one does
But project templates are outdated
Denis Podgorodnichenko
@qadmium
Jun 09 2017 09:44
thx, I will check
this one should work with VS2015
previewer API haven't been changed for ages, so it should be compatible
Denis Podgorodnichenko
@qadmium
Jun 09 2017 09:45
probably I have to install VS2017, thx anyway
Nikita Tsukanov
@kekekeks
Jun 09 2017 09:46
You won't have previewer for .NET Core projects
Other than that old extension should work fine with VS2015
Denis Podgorodnichenko
@qadmium
Jun 09 2017 10:08
thx, it works
Nikita Tsukanov
@kekekeks
Jun 09 2017 10:33
@grokys We are actually looking for "priority queue with duplicate elimination"
Steven Kirk
@grokys
Jun 09 2017 10:34
yeah something like that
Nikita Tsukanov
@kekekeks
Jun 09 2017 10:35
I guess List<Queue<T>> would be the most effective solution
Since it's fast and doesn't introduce allocations
The only costly operation would be removing elements from queue when visual queued for layout pass is detached from the tree
But that's a rare operation, so we should be fine
Steven Kirk
@grokys
Jun 09 2017 10:40
yeah, i agree with you - i think that's the best solution for now... we might want to reconsider when we get to performance tuning but for now it's the least bad option
btw with embedding is this what you were needing? AvaloniaUI/Avalonia@3f819b1
no longer using MaxClientSize for measuring root as it was incorrect
Nikita Tsukanov
@kekekeks
Jun 09 2017 10:49
I'm not sure that I exactly need it
Since embedding is now working with some other changes in layout
+ InvalidateMeasure is now virtual
InitialLayoutPass always happens with ClientSize = (0, 0) though
I'm not sure if it's ok
Nikita Tsukanov
@kekekeks
Jun 09 2017 10:56
BTW, where should I get said EmbeddedConstraint?
From last MeasureOverride call from WPF?
Nikita Tsukanov
@kekekeks
Jun 09 2017 11:51
@grokys why are you removing visual after measure call?
So it won't be readded?
Also IEnumerable seems to be inefficient
If we end up with List<Queue<IVisual>> + HashSet<IVisual> I'd suggest something like
void Add(int priority, T item);
T TryDequeue();
void Consume(T item);
void Remove(int oldPriority, T item)
TryDequeue will remove visual from the queue, but keep it in the hash set so it won't be readded
Consume will only remove it from the hash set
Steven Kirk
@grokys
Jun 09 2017 11:57
yeah, that all needs re-doing
problem is that invoking a measure on one control can cause another control's measure to be invalidated
so iterating the collection can cause the collection to be updated
i think we need to copy dirty controls into a new collection, clear the collection and then iterate
then once we've finished, check the _toMeasure again for controls that were invalidated by the previous measure
Nikita Tsukanov
@kekekeks
Jun 09 2017 12:06
Hm
So we don't actually need that complex data structure
Just a HashSet<IVisual>
And on each layout pass we could convert it to a list
And sort that list
Alex Khomchenko
@gagoman
Jun 09 2017 13:32
SortedSet?
Steven Kirk
@grokys
Jun 09 2017 13:36
@gagoman sortedset doesn't allow duplicates
@kekekeks yeah that's probably a good idea!
Alex Khomchenko
@gagoman
Jun 09 2017 14:57
Ok, I'm not a .NET guy at all but any set by it's nature doesn't allow duplicates
Matthijs ter Woord
@mterwoord
Jun 09 2017 15:08
I have gotten avalonia to work on raspberry! :)
soerendd
@soerendd
Jun 09 2017 15:18
@mterwoord how is the performance?
Did you use dotnet core or mono?
Matthijs ter Woord
@mterwoord
Jun 09 2017 15:19
.net core
performance? lousy.. ;)
but that's on startup, not sure how the running perf is..
that's for later.. ;)
soerendd
@soerendd
Jun 09 2017 15:21
Question is where the bottleneck is. Maybe it's skia. Maybe skia can use opengl es.
Matthijs ter Woord
@mterwoord
Jun 09 2017 15:21
.net core for raspberry/linux arm is still in preview..
i'm suspecting .net itself is still slow as well
soerendd
@soerendd
Jun 09 2017 15:22
You use Ubuntu? I will have to wait for a raspbian build of dotnet core
Matthijs ter Woord
@mterwoord
Jun 09 2017 15:22
raspbian
i'm not sinstalling .net core on the raspberry, i use dotnet publish
soerendd
@soerendd
Jun 09 2017 15:22
Ahhh OK.
Matthijs ter Woord
@mterwoord
Jun 09 2017 15:23
I use that to build for linux, comnbined with a custom build of libskiasharp
man. i'm really excited this all works..
:)
danwalmsley
@danwalmsley
Jun 09 2017 15:25
@mterwoord looking forward to seeing a video ;) great work!
Matthijs ter Woord
@mterwoord
Jun 09 2017 15:25
well, thank @kekekeks for pushing me in the right direction: I was using skiasharp master, now built using 1.57.1
i will be opening up the script and patch files tsoon
then will be trying to be able to build without my raspberry for the headers
soerendd
@soerendd
Jun 09 2017 15:42
@mterwoord great work. Very amazing!
Matthijs ter Woord
@mterwoord
Jun 09 2017 15:55
Thanks!
it takes about 20-25 seconds (on a rpi 3) to show a simple screen
Matthijs ter Woord
@mterwoord
Jun 09 2017 16:26
For whoever it may find interesting: https://github.com/terwoord/skiasharp-raspberry
Curently, the script doesn't automagically apply the patches
also, it still assumes a live raspberry..
must say this is a great way to start the weekend.. :)
Matthijs ter Woord
@mterwoord
Jun 09 2017 17:25
is the avalonia visual studio addin not yet avalable for vs 2017?
never mind.. :)
found it.
Nikita Tsukanov
@kekekeks
Jun 09 2017 19:02
@gagoman the problem is that even things like SortedList (which, according to its name, is a List) doesn't allow duplicated

it takes about 20-25 seconds (on a rpi 3) to show a simple screen

Startup time is slow even on Desktop

A lot of stuff to JIT, I guess