Comments (3)
Thanks for your report and benchmark.
It was already planned to bundle a custom and limited deepEqual
function, as most of the checks done by generic deepEqual libraries are not necessary in the context of monolite, and have a big impact on performance.
This will be the next perfomance optimization on monolite, along with the static accessor function resolution optimization once TypeScript officially provides custom AST transforms in version 2.3 (microsoft/TypeScript#13940).
from monolite.
I ran some tests myself.
Here is the test: https://gist.github.com/drew-wallace/2033bf6c9aedd1cfe09e78d8246949da
Here are the results of a single test run:
Test 1
- lodash took 21.674999999999272 milliseconds: true false
- stringify took 1192.65 milliseconds: true false
- deepEqual took 749.0799999999999 milliseconds: true false
- value_equal took 17.099999999999454 milliseconds: true false
Test 2
- lodash took 27.395000000000437 milliseconds: true false
- stringify took 1030.8950000000004 milliseconds: true false
- deepEqual took 649.5 milliseconds: true false
- value_equal took 17.3100000000004 milliseconds: true false
Test 3
- lodash took 22.590000000000146 milliseconds: true false
- stringify took 1092.255000000001 milliseconds: true false
- deepEqual took 796.1800000000003 milliseconds: true false
- value_equal took 16.904999999998836 milliseconds: true false
Test 4
- lodash took 25.965000000000146 milliseconds: true false
- stringify took 953.335000000001 milliseconds: true false
- deepEqual took 618.0299999999988 milliseconds: true false
- value_equal took 18.7549999999992 milliseconds: true false
Test 5
- lodash took 21.404999999998836 milliseconds: true false
- stringify took 1030.9050000000007 milliseconds: true false
- deepEqual took 644.0100000000002 milliseconds: true false
- value_equal took 8.524999999999636 milliseconds: true false
In other tests lodash would perform slower than all the others by a vast amount in Test 1 but subsequent tests showed a ramp up in performance most likely from caching the results.
I would advise switching to the value_equal or lodash isEqual functions I mentioned above for better performance.
from monolite.
I now provide a custom deepEqual function since 76c25a8.
It's intentionally limited, and will need to be enhanced in objectEqual
function performance which uses Object.getOwnPropertyNames
.
from monolite.
Related Issues (20)
- Can use an array as root object? HOT 1
- Setup TSLint
- Use Jest instead of Mocha HOT 1
- Add RegEx-based getAccessorChain to support ES5 HOT 3
- add support for ES6 Map's
- Flow types not type validating correctly HOT 2
- Possibly null values in the input data? HOT 6
- Missing null guard in deepEqual HOT 5
- deepEqual usage of Object.getOwnPropertyNames
- Zapier Test
- Monolite with react, redux and array HOT 2
- Possibility for IE11 support? HOT 5
- Bundle Babel Plugin in Monolite HOT 1
- Add support for collection mapping
- Babel plugin: nested set not transformed
- node/electron target HOT 2
- Type inference fails with optional state parameters
- ReferenceError: window is not defined in node_modules/monolite/lib/monolite/index.js:1 HOT 7
- Idea
- Add merge function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from monolite.