Parallelism¶
Namespace Nfty.Core in assembly Nfty.Core.
How wide independent per-item work may run. Output never depends on it: every parallel step writes to its own slot, so one thread and many give byte-identical results.
Remarks¶
Equality is by Parallelism.Requested alone. The degree actually used is Parallelism.Effective, which the library clamps to the machine's logical processor count.
Constructors¶
Parallelism(int)¶
Parameters
Requested(int) - The degree asked for; 0 means every logical processor. Negative is refused.
Remarks
Equality is by Parallelism.Requested alone. The degree actually used is Parallelism.Effective, which the library clamps to the machine's logical processor count.
Fields¶
EnvironmentVariable¶
The environment variable that overrides the saved or default count for one run.
Properties¶
All¶
Every logical processor.
Default¶
The default degree.
DefaultDegree¶
Two thirds of the logical processors, floored, and at least one.
Effective¶
The degree that actually runs: clamped to between 1 and the logical processor count.
IsSequential¶
True when work runs on the calling thread.
LogicalProcessors¶
The machine's logical processor count (affinity- and container-aware).
Requested¶
The degree requested; 0 means all.
Sequential¶
One thread, on a plain loop with no scheduler involved.
Methods¶
TryParse(string?, Parallelism)¶
Reads a thread count as people spell it: a whole number, or max; 0 and max both mean every logical processor. The one rule the CLI's --threads, the NFTY_THREADS variable and the app's Settings card all share. Nothing is clamped here: a count above the machine's is a valid request, and Parallelism.Effective brings it down.
Parameters
text(string?) - The text, with surrounding whitespace ignored.parallelism(Parallelism) - The count when this returns true;Parallelism.Defaultotherwise.
Returns. False for empty text, a sign, a fraction or anything else that is not a whole number or max.