[Performance] It takes 7s to calculate 500 object
CodeEagle opened this issue · comments
It takes 7s to calculate 500 object
The Object
is a custom class
, with properties and some other methods,
will spend much time than using Int
or String
as T
Your comment suggests that you're not experiencing bad performance with system types such as Int
, and that you're only having issues with your custom class. This suggests that your class may have a slow ==
implementation. If this is the case, there's not a lot that can be done at the library level to fix this. I'd strongly suggest not using a class as the generic parameter to begin with, as you'll have to incur the penalty of many, many dynamic dispatches to isEqual
during the diff calculation. Instead, I would map your array of objects into either a primitive type such as String or a custom struct that can be more quickly compared. For example, if you are trying to compare two arrays of User
classes, but each person is guaranteed to have a unique ID, first map your array of users into just their IDs, and use that to drive the rows
of your DiffCalculator or whatever.
Right about that, may update in README for guiding other developer