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
@@ -146,15 +147,15 @@ The join method in `@objectwow/join` offers better performance compared to the j
146
147
### Traditional Approach (Database, Krakend, Hasura, GraphQL):
147
148
148
149
1. Loop through the original array.
149
-
2.`For each element, make a call` to the table/service containing the related data by its ID.
150
+
2.`For each element, make a call` to the `database/internal/external service` containing the related data by its `UID` (unique identifier).
150
151
3. Combine the data from both sources.
151
152
4. This results in a time complexity of `O(n x m)`, where `n` is the number of elements in the original array, and `m` is the number of elements fetched from the related table or service.
152
153
153
154
### @objectwow/join Approach:
154
155
155
-
1. Provides a `callback function` where the input is `an array of IDs`, allowing the developer to fetch related data from the table/service in a `single call`.
156
-
2. Uses JavaScript’s `new Map` to optimize the process, reducing the time complexity from O(m) to O(1), where m is the number of elements retrieved..
157
-
3. Combines the data efficiently after retrieving it in bulk through a `single call`.
156
+
1. Provides a `callback function` where the input is `UIDs`, allowing the developer to fetch related data from the `database/internal/external service` in a `single call`.
157
+
2. Uses JavaScript’s `new Map` to optimize the process, reducing the time complexity from O(m) to O(1), where `m` is the number of elements retrieved..
158
+
3. Combines the data efficiently after retrieving it in bulk through a single call.
158
159
4. This results in a time complexity of O(n), where `n` is the number of elements in the original array.
159
160
160
161
By fetching related data in bulk and leveraging efficient JavaScript data structures, `@objectwow/join` minimizes redundant calls and improves overall performance.
0 commit comments