Do not recompile unnecessarily #1807
Unanswered
notramo
asked this question in
Feature requests & Ideas
Replies: 1 comment 1 reply
-
You can actually just compile these if you need.
That will compile all of our tasks and allow you to use the ones you don't want to recompile each time but still give you the escape of using I think when the interpreter is default in Crystal, those tasks will actually just run in interpreted mode by default to reduce runtime and we'd just add a flag to tell it to compile and store the binary and run.
I haven't put a ton of thought in to it since the interpreter is still a bit away. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Compilation takes long time on lower end devices.
lucky
recompiles the app every time it runs a task. It's sometimes necessary, but there are many cases where it's not, because the code haven't changed.For example, when I write a migration, I always test the rollback feature at least 2 times (
migrate
-rollback
-migrate
-rollback
-migrate
). In this case, if there are no errors, recompilation would be unnecessary.Another case is editing a file that doesn't affect Crystal code, e.g. credentials in
.env
. When the developer edits e.g. a password, and restarts the app, recompilation is not necessary.Another use case is when the developer runs
lucky gen.*
commands, but mistype the name.Another example is the
--help
command.Tracking changed code is complicated, and there could be many factors that would influence compilation outcome (e.g. compile-time values in ENV vars which are read by macros), so the simplest solution would be to leave it to the user to know if they made changes or not.
I suggest adding a switch (e.g.
-n
,--no-recompile
), which would enablelucky
to use the latest compiled binary.lucky db.migrate
- recompiles, and runslucky -n db.migrate
- runs the latest compiled version againBeta Was this translation helpful? Give feedback.
All reactions