Comments (4)
Thanks for the test code. We've identified a buffer allocation issue in BufferWriter
. The fix in #293 should resolve this issue.
from psi.
Hi, sorry for missing this until now. One quick question: is the behavior reproducible outside of UWP and without StereoKit? Can you construct a more minimal test example that exhibits the behavior?
from psi.
No worries! Yes, I've modified the script to a DotNet console app where you can comment out the specific portion in the Vertex
struct to use either 1) common float array or 2) MathNet types. The tests at the bottom also exhibit the runtime differences when TrackMessageSize
is enabled or not.
using Microsoft.Psi;
using Microsoft.Psi.Data;
using System.Diagnostics;
using MathNet.Spatial.Euclidean;
int[] sizes = { 1000, 10000, 20000, 30000 };
foreach (int size in sizes)
{
using var pipeline = Pipeline.Create(
"TestHang",
enableDiagnostics: true,
diagnosticsConfiguration: new Microsoft.Psi.Diagnostics.DiagnosticsConfiguration
{
TrackMessageSize = true,
AveragingTimeSpan = TimeSpan.FromSeconds(2),
SamplingInterval = TimeSpan.FromSeconds(10),
IncludeStoppedPipelines = true,
IncludeStoppedPipelineElements = true,
});
PsiExporter store = PsiStore.Create(pipeline, pipeline.Name, Directory.GetCurrentDirectory());
pipeline.Diagnostics.Write("Diagnostics", store);
Generators.Range(pipeline, 0, 5, TimeSpan.FromMilliseconds(1))
.PipeTo(new TstProducer(pipeline, size))
.PipeTo(new TstReceiver(pipeline));
Stopwatch? sw = null;
pipeline.PipelineRun += (_, _) => { Console.WriteLine("Started!"); sw = Stopwatch.StartNew(); };
pipeline.PipelineCompleted += (_, _) => { Console.WriteLine($"Completed in {sw?.ElapsedMilliseconds}"); };
pipeline.Run();
}
public struct Vertex
{
public Vertex() {}
// TEST 1: common types
public double[] pos = {0, 0, 0};
public double[] norm = {0, 0, 0};
public double[] uv = {0, 0, 0};
// TEST 2: MathNet types
// public Vector3D pos;
// public Vector3D norm;
// public Vector3D uv;
}
class TstProducer : IConsumer<int>, IProducer<Shared<Vertex[]>>
{
public Receiver<int> In { get; }
public Emitter<Shared<Vertex[]>> Out { get; }
public TstProducer(Pipeline pipeline, int size)
{
Out = pipeline.CreateEmitter<Shared<Vertex[]>>(this, nameof(Out));
In = pipeline.CreateReceiver<int>(this, (_, env) =>
{
using var verts = Shared.Create(new Vertex[size]);
Out.Post(verts, env.OriginatingTime);
}, nameof(In));
}
}
class TstReceiver : IConsumer<Shared<Vertex[]>>
{
public Receiver<Shared<Vertex[]>> In { get; }
public TstReceiver(Pipeline pipeline)
{
In = pipeline.CreateReceiver<Shared<Vertex[]>>(this, (msg, env) =>
{
Console.WriteLine($"msg length: {msg.Resource.Length}");
}, nameof(In));
}
}
TEST 1: Common Types TrackMessageSize=TRUE
>dotnet run
Started!
msg length: 1000
msg length: 1000
msg length: 1000
msg length: 1000
msg length: 1000
Completed in 42
Started!
msg length: 10000
msg length: 10000
msg length: 10000
msg length: 10000
msg length: 10000
Completed in 148
Started!
msg length: 20000
msg length: 20000
msg length: 20000
msg length: 20000
msg length: 20000
Completed in 1619
Started!
msg length: 30000
msg length: 30000
msg length: 30000
msg length: 30000
msg length: 30000
Completed in 4974
TEST 2: MathNet Types TrackMessageSize=TRUE
>dotnet run
Started!
msg length: 1000
msg length: 1000
msg length: 1000
msg length: 1000
msg length: 1000
Completed in 45
Started!
msg length: 10000
msg length: 10000
msg length: 10000
msg length: 10000
msg length: 10000
Completed in 2989
Started!
msg length: 20000
msg length: 20000
msg length: 20000
msg length: 20000
msg length: 20000
Completed in 6232
Started!
msg length: 30000
msg length: 30000
msg length: 30000
msg length: 30000
msg length: 30000
Completed in 12080
TEST 1: Common Types TrackMessageSize=FALSE
>dotnet run
Started!
msg length: 1000
msg length: 1000
msg length: 1000
msg length: 1000
msg length: 1000
Completed in 40
Started!
msg length: 10000
msg length: 10000
msg length: 10000
msg length: 10000
msg length: 10000
Completed in 4
Started!
msg length: 20000
msg length: 20000
msg length: 20000
msg length: 20000
msg length: 20000
Completed in 5
Started!
msg length: 30000
msg length: 30000
msg length: 30000
msg length: 30000
msg length: 30000
Completed in 5
TEST 2: MathNet Types TrackMessageSize=FALSE
>dotnet run
Started!
msg length: 1000
msg length: 1000
msg length: 1000
msg length: 1000
msg length: 1000
Completed in 40
Started!
msg length: 10000
msg length: 10000
msg length: 10000
msg length: 10000
msg length: 10000
Completed in 4
Started!
msg length: 20000
msg length: 20000
msg length: 20000
msg length: 20000
msg length: 20000
Completed in 4
Started!
msg length: 30000
msg length: 30000
msg length: 30000
msg length: 30000
msg length: 30000
Completed in 4
from psi.
That makes a huge difference, thank you all so much!
from psi.
Related Issues (20)
- Feature request: Pause a pipeline HOT 11
- FFmpeg probelm HOT 2
- Question about "FFMPEGMediaSource.cs" HOT 2
- Request to make Microsoft.Psi.MixedReality.StereoKitTransforms properties public HOT 3
- Troubles with RemoteImporter HOT 6
- Will the implementation of "Continual Learning about Objects in the Wild: An Interactive Approach" be opensource? HOT 2
- PSI on Oculus Quest (Android) HOT 4
- Publicizing StereoKitTransforms properties HOT 1
- `NullReferenceException` in MixedReality.cs HOT 1
- Thread-safety bug for the pipeline's stopping state HOT 1
- HoloLens 2 ir cam intrinsics HOT 4
- Fix missing project Microsoft.Psi.Audio.Windows in solution HoloLensCapture.sln
- \psi Studio's 3D panel not rendering properly when using the integrated GPU (but ok with an external monitor) HOT 1
- [Bug]: Hitting an exception when attempting to start hololenscaptureapp in hololens2 using VS2022 HOT 5
- Memory usage of SharedImagePool keeps growing HOT 3
- [Question] Subpipline stop without stopping parent pipline HOT 5
- .NET Native Support
- PsiStoreReader has an inconsistent output for indexed entries on different projects (DotNet vs. UWP) same x64 architecture HOT 2
- Could not load file or assembly 'Microsoft.Psi.Media_Interop.Windows.x64, Version=0.18.72.1, Culture=neutral, PublicKeyToken=null' or one of its dependencies. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from psi.