microsoft / microsoft/durabletask-dotnet
Performance: reduce per-call SHA1 allocation for deterministic orchestration GUIDs
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 193
- Forks
- 60
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 4
Description
1. What is the issue?
Each call to the deterministic orchestration NewGuid() implementation creates and disposes a new SHA1 HashAlgorithm instance.
2. Likely priority
Low. It affects orchestrations that use context.NewGuid() frequently, including some entity correlation paths, but other per-call allocations are likely larger.
3. Impact on performance
Repeated hash-algorithm construction adds allocation and disposal overhead during orchestration replay. The cost scales with the number of deterministic GUIDs generated per execution.
4. Details and code reference
Deterministic GUID implementation:
SHA1 creation is here:
5. Guidance for how to fix
Treat this as replay-compatibility-sensitive. Any reuse or replacement must produce byte-for-byte identical GUIDs for existing instance ID, timestamp, and counter inputs across supported target frameworks. Prefer an isolated optimization with deterministic-value regression tests before and after the change; do not change the namespace, hash input, byte ordering, SHA1 algorithm, or version-bit handling.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/Worker/Core/Shims/TaskOrchestrationContextWrapper.cs, especially the deterministic GUID implementation and SHA1 creation around lines 403-458. Compare the current behavior across supported target frameworks and add or run deterministic-value regression tests. Done means reducing the per-call allocation while preserving byte-for-byte identical GUIDs, including namespace, hash input, byte ordering, SHA1, and version bits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend, performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100