fix: replace slow deep-equal with fastDeepEqual to resolve CPU bottleneck (#19771)
## Summary - Replaced the `deep-equal` npm package with the existing `fastDeepEqual` from `twenty-shared/utils` across 5 files in the server and shared packages - `deep-equal` was causing severe CPU overhead in the record update hot path (`executeMany` → `formatTwentyOrmEventToDatabaseBatchEvent` → `objectRecordChangedValues` → `deepEqual`, called **per field per record**) - `fastDeepEqual` is ~100x faster for plain JSON database records since it skips unnecessary prototype chain inspection and edge-case handling - Removed the now-unnecessary `LARGE_JSON_FIELDS` branching in `objectRecordChangedValues` since all fields now use the fast implementation
This commit is contained in:
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { isNonEmptyString } from '@sniptt/guards';
|
||||
import deepEqual from 'deep-equal';
|
||||
import { fastDeepEqual } from 'twenty-shared/utils';
|
||||
|
||||
import {
|
||||
type DiscoveredMessageFolder,
|
||||
@@ -62,7 +62,7 @@ export const computeFoldersToUpdate = ({
|
||||
: null,
|
||||
};
|
||||
|
||||
if (!deepEqual(discoveredFolderData, existingFolderData)) {
|
||||
if (!fastDeepEqual(discoveredFolderData, existingFolderData)) {
|
||||
foldersToUpdate.set(existingFolder.id, discoveredFolderData);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user