Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discussion] Are there any compile-time performance costs to have readonly everywhere? #93

Open
kirillgroshkov opened this issue Aug 26, 2018 · 1 comment

Comments

@kirillgroshkov
Copy link

Are there any compile-time performance costs to have readonly everywhere? The whole project and idea sounds super legit to me, but I'm afraid to automatically convert my whole codebase to e.g readonly everywhere. Should I be afraid?

(I understand it's more Typescript question, but still)

@jonaskello
Copy link
Owner

I have not seen any performance degradation using the reaonly keyword, but then I cannot really say that I have measured it. About a year ago I did an auto-fix of a large code base and all readonly keyword fixes was smooth but I ran into some problem with ReadonlyArray. What happened was that tsc crashed with stack overflow. There was already an issue about it on the typescript repo and I guess much has been fixed in typescript since then.

Anyway, if your setup allows for it, my advice would be to make a new branch in your project, add the linting rules, run auto-fix all (tslint --fix), and then measure the performance of tsc and compare it to the original branch. If you do, please share your results as it would be interesting to know :-).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants