piotrwitek / typesafe-actions

Typesafe utilities for "action-creators" in Redux / Flux Architecture
https://codesandbox.io/s/github/piotrwitek/typesafe-actions/tree/master/codesandbox
MIT License
2.41k stars 99 forks source link

High memory consumption #168

Closed zdila closed 5 years ago

zdila commented 5 years ago

Issuehunt badges

Description

Cmpiling application with couple of reducers (~20) and action creators (~200) takes 2 GB RAM and requires passing --max-old-space-size to node when invoking tsc. Before fixing #164 it was much worse but it is still unuseable.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Download and unpack https://drive.google.com/file/d/1FUzk5NeRfxUvwd4eXCxIFcb7Scmvh9D4/view?usp=sharing
  2. run npm i
  3. run node --max-old-space-size=8192 ./node_modules/.bin/tsc --diagnostics
  4. See the result

Expected behavior

Compilation of such project should be a piece of cake ;-)

Suggested solution(s)

Improve types or identify bug in TypeScript.

Project Dependencies

Environment (optional)


IssueHunt Summary # # # # [ < i m g s r c = ' h t t p s : / / a v a t a r s 0 . g i t h u b u s e r c o n t e n t . c o m / u / 7 3 9 0 7 5 ? v = 4 ' a l t = ' p i o t r w i t e k ' w i d t h = 2 4 h e i g h t = 2 4 > p i o t r w i t e k ] ( h t t p s : / / i s s u e h u n t . i o / u / p i o t r w i t e k ) h a s b e e n r e w a r d e d . ### Backers (Total: $140.00) - [issuehunt issuehunt](https://issuehunt.io/u/issuehunt) ($140.00) ### Submitted pull Requests - [#171 #168](https://issuehunt.io/r/piotrwitek/typesafe-actions/pull/171) --- ### Tips - Checkout the [Issuehunt explorer](https://issuehunt.io/r/piotrwitek/typesafe-actions/) to discover more funded issues. - Need some help from other developers? [Add your repositories](https://issuehunt.io/r/new) on IssueHunt to raise funds. --- IssueHunt has been backed by the following sponsors. [Become a sponsor](https://issuehunt.io/membership/members)
hsz commented 5 years ago

I can confirm that as well. Cold start of tsc still takes too much of the resources and time.

mmalicki commented 5 years ago

Probably related to this, I noticed when I changed all my reducers from standard switch case to createReducer, compiler typechecking and autocomplete (in both VSCode and IntelliJ) slowed down noticably to the point where it's painful to use

zdila commented 5 years ago

@mmalicki that was actually also my case

piotrwitek commented 5 years ago

Thanks for the reproduction case 👍. I have confirmed an issue and will be working on that.

issuehunt-oss[bot] commented 5 years ago

@issuehunt has funded $140.00 to this issue.


hilkeheremans commented 5 years ago

I can also confirm the issue. Thanks so much for looking into it!

piotrwitek commented 5 years ago

PR is ready, now it's infinitely scalable. will release a new version tomorrow.

@zdila You can test it now using the following in your project to confirm: npm i piotrwitek/typesafe-actions##168

Screen Shot 2019-06-24 at 3 01 13 AM

zdila commented 5 years ago

@piotrwitek thanks, but with npm i piotrwitek/typesafe-actions##168 there is no more dist in node_modules/typesafe-actions.

piotrwitek commented 5 years ago

@zdila you can build the project locally and copy the dist folder or wait for me to release under the next branch in a few hours

piotrwitek commented 5 years ago

Published on npm as @next

issuehunt-oss[bot] commented 5 years ago

@piotrwitek has rewarded $98.00 to @piotrwitek. See it on IssueHunt

hsz commented 5 years ago

Shouldn't that be released as v4.5.0 since it's a major performance issue?

piotrwitek commented 5 years ago

There is a breaking change in the API and I'm respecting semver. But I might consider it if that is something critical to the majority of the users.

hsz commented 5 years ago

After upgrading to @next release, project hangs on tsc again with memory leak at the end (19x createAsyncAction, 1x createStandardAction). 4.4.2 is working fine. What can I do to provide you more details?

zdila commented 5 years ago

In my case typesafe-actions@next works now fine on my project. Thanks Piotr.

piotrwitek commented 5 years ago

@hsz take a look at a great reproduction example from @zdila above and try to isolate the issue in your project in the same way. Only this way we can confirm the issue is on our end and not within your application setup.