Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Refactoring: embedded "compiler/crystal" by crystal commandline #30

Closed
faustinoaq opened this issue Sep 28, 2017 · 6 comments
Closed

Refactoring: embedded "compiler/crystal" by crystal commandline #30

faustinoaq opened this issue Sep 28, 2017 · 6 comments

Comments

@faustinoaq
Copy link
Member

faustinoaq commented Sep 28, 2017

Currently Scry uses a huge amout of memory because the crystal compiler is embedded on it.
Scry analyze files every time a file is saved without checking if the file have been truly changed increasing even more the footprint (aprox. over 300 MB RAM on Linux)

Also maybe we can use external crystal processes instead of using require "compiler/crystal/**" ('cause, compiler is very heavy) I think using processes will free memory easier and improve Scry performance.

Also new features as types on hover and refactoring could be easier to implement.

@faustinoaq faustinoaq changed the title Improve Performance Use crystal processes instead of require compiler/crystal Sep 28, 2017
@faustinoaq faustinoaq changed the title Use crystal processes instead of require compiler/crystal Change require compiler/crystal by external crystal processes Sep 28, 2017
@faustinoaq faustinoaq changed the title Change require compiler/crystal by external crystal processes Change require compiler/crystal by external crystal processes Sep 28, 2017
@faustinoaq faustinoaq changed the title Change require compiler/crystal by external crystal processes Change require "compiler/crystal" by external crystal processes Sep 28, 2017
@keplersj
Copy link
Contributor

I'm not sure this is a good idea. Can we get the opinion from someone on the language team? @mverzilli? @bcardiff?

@bcardiff
Copy link
Member

Maybe for some tasks like syntax error and compilation error calling the compiler as an external process could work, but at the end of the day, if there is some analysis like extracting type information for subexpressions or variables in scope either the compiler need to provide that functionality or the compiler needs to be embebed.

I am unaware of what features scry already build on top of crystal compiler, but that is the aspect that needs to be analyzed to decide whether it is feasible or not.

@bcardiff
Copy link
Member

Shipping a custom crystal compiler can be done but need to be done carefully. crystal env serves for extracting the environment information used in the wrapper scripts. The compiler should be built in release mode, and maybe the whole compiler is not needed. But right now at most the compiler can be required in ast/parser/lexer/full modes depending on directories AFAIK. That could help to minimize the size of the binary and memory footprint, but again, depending on the needed features by scry

@faustinoaq
Copy link
Member Author

faustinoaq commented Sep 28, 2017

@bcardiff Thanks your for your comments, I will do some tests to check performance between embedded crystal vs external crystal processes.

Maybe for some tasks like syntax error and compilation error calling the compiler as an external process could work

I agree with you, currently all features Scry has are supported by crystal tool commands

I think require "compiler/crystal/**" will be useful for other things.

Also we are thinking on implement completion using external tool like cracker [0]

[0] - https://github.com/TechMagister/cracker

The only missing tools right now on crystal compiler are rename and list symbols, do you think can we have these on crystal compiler too?

Are transformations or visitor examples like refactoring ? WDYT @asterite ?

@faustinoaq
Copy link
Member Author

refactoring

Would be awesome to have something like this on crystal 😅

Reference https://twitter.com/rachsmithtweets/status/907350440634748928

@faustinoaq faustinoaq changed the title Change require "compiler/crystal" by external crystal processes Refactoring: embedded "compiler/crystal" by crystal commandline Oct 9, 2017
@faustinoaq
Copy link
Member Author

Rename is likely to be achieved using something like #101 (comment)

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

No branches or pull requests

3 participants