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:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user