nalka
❔ Need help to optimize this simulation
For context, I'm trying to build a simulation where you start with X "nodes" and every "round", one node is replaced by one of X predetermined possibilities (
.NextNodes
, which may be empty) and so on until Xth round is reached.
For example, we could be working with integers and on each round one of the integers we have gets +1 or +2 so if we start with 1 and 3 and play 2 rounds some of the results could be
- 3 (1 + 1 + 1) and 3
- 4 (1 + 1 + 2) and 3
- 3 (1 + 2) and 4 (3 + 1)
...
The aim of the simulation is to compute every possible outcome and so far it works fine with little amount of data or start nodes but if I scale up to a point where I have a few million possibilities I start feeling the slowness and if I go even further it doesn't even finish.
I'm pretty sure the most important thing to do is instantiating far less lists, but I can't figure out how. I also thought about creating one task per initial node and that task would only focus on cases where its initial node is replaced in the first round to parallelize but that wouldn't fix the memory eaten by those many lists.
Here's my actual method :
241 replies
❔ Can't get the source generators tutorial to work
As the title says, I'm following the source generators tutorial that's here : https://learn.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/source-generators-overview
But when I launch my console app (.net 7) nothing is displayed, I'm most likely stuck with step 7 (linking the source generator with my console app) but at this point I really don't see what could be wrong given I have no errors nor warnings...
Like displayed on step 9, I have SourceGenerator in my console app's analyzers but there's nothing below it (so no SourceGenerator.HelloSourceGenerator and Program.cs that appear on the tutorial's screenshot)
22 replies