You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The implementation of mapValues in the typescript-fetch runtime currently takes O(n^2) time relative to the number of keys (n) in the data object. This is due to the use of the spread operator ... within the reduce callback, which copies the entire accumulated object on every iteration.
The implementation of
mapValues
in thetypescript-fetch
runtime currently takes O(n^2) time relative to the number of keys (n
) in thedata
object. This is due to the use of the spread operator...
within thereduce
callback, which copies the entire accumulated object on every iteration.Problem code:
https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache#L335-L340
Impact:
This inefficiency can lead to noticeable performance degradation in generated clients.
Proposed solution:
Use a simple loop with direct assignment to improve the performance. I will put up a PR shortly with the proposed fix.
The text was updated successfully, but these errors were encountered: