chore(): Improve workflows sdk tooling (#13421)

RESOLVES CORE-1171

**What**
 - Reduced async overhead for objects with mixed sync/async properties
 - Lower memory pressure from eliminated promise allocations
 - Faster primitive value processing with early returns
 - Better concurrency through selective batching of truly async operations
 - Event loop friendly behavior preventing artificial delays
 - Reduced memory allocation from eliminated duplicate processing
 - Decreased GC pressure from WeakMap-based caching instead of map

**note**
Now, `resolveValue`always treat every resoltion as sync operation unless it is not, meaning we do not create promise overhead when not necessary and only when actually treating with promises
This commit is contained in:
Adrien de Peretti
2025-09-08 18:24:10 +02:00
committed by GitHub
parent 8e11998895
commit 8e5c22a8e8
10 changed files with 304 additions and 110 deletions

View File

@@ -33,12 +33,12 @@ export function deepCopy<
return copy
}
if (util.types.isProxy(obj)) {
return obj as unknown as TOutput
}
// Handle objects
if (isObject(obj)) {
if (util.types.isProxy(obj)) {
return obj as unknown as TOutput
}
copy = {} as TOutput
cache.set(obj, copy) // Add to cache before recursing

View File

@@ -6,7 +6,7 @@ import { isDefined } from "./is-defined"
* @returns
*/
export function parseStringifyIfNecessary(result: unknown) {
if (typeof result !== "object") {
if (typeof result == null || typeof result !== "object") {
return result
}