question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

poor performance on lodash flow check

See original GitHub issue

I found that #1696 (better handling null/undefined) introduced bad performance to flow checking

tested with flow version 0.63, 0.64 tested script

// @flow

import _ from 'lodash';

_.map([], () => 0);
comparison file time spent
before before pr #1696 ~2 seconds
after current master ~45 seconds

Could we do anything to improve this?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
Zmetsercommented, Feb 2, 2018

Removing all the individual module declarations (introduced here) solved this for me. @maxmalov

1reaction
Zmetsercommented, Feb 3, 2018

@maxmalov You’re right, I’m sorry. You just added the fp exports and I removed all.

Still, removing all the individual exports speeds up flow. Here’s a test repo where flow only reads the lodash libdef and does nothing else when you run yarn flow and there’s almost a minute difference. https://github.com/Zmetser/lodash_flow_test

Read more comments on GitHub >

github_iconTop Results From Across the Web

Performance degradation of flow check · Issue #5858 - GitHub
It seems that the flow-typed definitions for lodash v4.x.x (https://github.com/flowtype/flow-typed/blob/master/definitions/npm/lodash_v4.x.x/ ...
Read more >
Better and more performant than lodash chain - Stack Overflow
Flow works better with lodash/fp, since the methods are iteratee-first and data-last. This saves the need to partial right every method that ...
Read more >
Lodash Documentation
Checks if value is an empty object, collection, map, or set. Objects are considered empty if they have no own enumerable string keyed...
Read more >
Lodash Performance Sucks! - TechFindings
The conclusion is that from a performance perspective Functional Programming sucks. Lodash sucks too, but a little bit less so than the standard ......
Read more >
Lodash FP usage retrospective - Coding with J.S.
I recently performed a small analysis of our usage of the library to spot some weird usages that have slipped through code reviews...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found