Max number of threads in Reactive Extensions / Parallel Extensions
Tag : chash , By : Robin Buitenhuis
Date : March 29 2020, 07:55 AM
seems to work fine Since Microsoft probably killed all download links to the Parallel Extensions CTP, I am totally lost. , Haven't found any solution. Used the default ThreadPool instead.
|
Why does CUDA Profiler indicate replayed instructions: 82% != global replay + local replay + shared replay?
Tag : cuda , By : FuzzyHornet
Date : March 29 2020, 07:55 AM
To fix this issue Because The SM can replay instructions due to other factors, like different branching logic. So I can assume that 60% of your code is being reissued due to branching and 20% due to global memory. Can you post a snippet ?
|
A brief guide to extensions, namespaces and assemblies in V1 of Reactive Extensions (Rx)
Tag : .net , By : Search Classroom
Date : March 29 2020, 07:55 AM
I wish this help you Assemblies System.Reactive.dll - The core APIs System.Reactive.Providers.dll - IQbservable interfaces and implementation over objects System.Reactive.Windows.Forms.dll - Schedulers and integration for WinForms System.Reactive.Windows.Threading.dll - Schedulers and integration for WPF/Silverlight Microsoft.Reactive.Testing.dll - Classes for testing Rx- Mocks, Recorders, Virtual schedulers, etc Namespaces System.Reactive.Concurrency - Schedulers System.Reactive.Disposables - Classes for creating and using disposables. (I was sad to see these classes moved into the Rx specific namespace, as they are generally useful) System.Reactive.Joins - Join matching patterns System.Reactive.Linq - Combinators and extension methods on IObservable and IQbservable. This is the main namespace for most consumers System.Reactive.Subjects - Subject implement both IObservable and IObserver and have state System.Reactive.Threading.Tasks - Interop to the TPL
|
Reactive Extensions / Reactive UI Observe collection, group it, and display it
Date : March 29 2020, 07:55 AM
With these it helps You can use ReactiveUI's reactive collection, which provides a number of observables including one for when the collection changes (Changed), and one for when the items in the collection change (ItemChanged). This can be combined with ObservableAsPropertyHelper for the dependent properties. The totalOfAll dependent property is quite straightforward. The other dependent property - groupedObjects - is a bit more complex. I'm not sure if I've understood your grouping requirements exactly. Hopefully the code below will be a starting point - it will project the collection of subobjects into an IEnumerable of anonymous objects, each containing a total, a row header, and the items. You should be able to bind to this in your view public class MyObject : ReactiveObject
{
public ReactiveCollection<MySubObject> Objects { get; set; }
private ObservableAsPropertyHelper<IEnumerable<object>> groupedObjectsHelper;
public IEnumerable<object> GroupedObjects
{
get {return groupedObjectsHelper.Value;}
}
private ObservableAsPropertyHelper<Decimal> totalOfAllHelper;
public Decimal TotalOfAll
{
get {return totalOfAllHelper.Value;}
}
public MyObject()
{
var whenObjectsChange=
Observable.Merge(Objects.Changed.Select(_ => Unit.Default),
Objects.ItemChanged.Select(_ => Unit.Default));
totalOfAllHelper=
whenObjectsChange.Select(_=>Objects.Sum(o => o.Value))
.ToProperty(this, t => t.TotalOfAll);
groupedObjectsHelper=
whenObjectsChange.Select(_=>Objects
.GroupBy(o => o.RowType)
.Select(g => new {RowType=g.Key,
RowTotal=g.Sum(o => o.Value),
Objects=g}))
.ToProperty(this, t => t.GroupedObjects);
}
}
|
Replay timestamped event stream with Reactive Extensions
Tag : chash , By : John Q.
Date : March 29 2020, 07:55 AM
it helps some times While my first answer is working as intended, performance of creating the observable sequence is not ideal with hundreds of thousands of events - you pay substantial initialization cost (order of 10 seconds on my machine). To improve performance, taking advantage of already sorted nature of my data, I implemented custom IEnumerable that is looping through events, yielding and sleeping between them. With this IEnumerable one can easily call ToObservable and it works as intended:IObservable<Event> CreateSimulation(IEnumerable<Event> events)
{
IEnumerable<Event> simulation()
{
foreach(var ev in events)
{
var now = DateTime.UtcNow;
if(ev.Timestamp > now)
{
Thread.Sleep(ev.Timestamp - now);
}
yield return ev;
}
}
return simulation().ToObservable();
}
|