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

module caching #310

Closed
bryanjos opened this issue Jul 3, 2017 · 8 comments
Closed

module caching #310

bryanjos opened this issue Jul 3, 2017 · 8 comments

Comments

@bryanjos
Copy link
Collaborator

bryanjos commented Jul 3, 2017

Caching of modules that have been compiled. The cached version should be used if the beam file has not been modified since the module was compiled. When the beam file is modified, that cache should be invalidated.

@bryanjos
Copy link
Collaborator Author

I think steps to make this happen include:

  • Keeping track of the beam file's modified date
  • Storing the generated JavaScript AST for modules
  • When a beam file's modified date does not match, do a full compile

What I'm not sure of is how to handle cases when the module itself hasn't changed and some other module uses a function on that module that was previously unused and not compiled. I am am guessing in order to handle that, the cache may need to keep track of functions compiled. Then at least if one if the above happens, it can force a cache invalidation

@bryanjos
Copy link
Collaborator Author

I am also not sure currently how the cache should be stored

@vans163
Copy link
Contributor

vans163 commented Aug 13, 2017

cache storage location could be set with a mix param? right beside input, output, etc?
a default location in the priv directory seems right, perhaps under elixir_script/ folder which is already required.

@bryanjos
Copy link
Collaborator Author

There isn't a need for the caching to be configurable or in the priv folder. The best places are probably the _build folder somewhere or a temp directory

@vans163
Copy link
Contributor

vans163 commented Aug 13, 2017

I thought you might want to use the same cache with multiple elixirscript projects, the performance benefits of this is probably negligible.

if by default temp dir is outside _build, such as in ~/.config or something, it gets really annoying to pass through the project as a volume to containers and such.

@vans163
Copy link
Contributor

vans163 commented Sep 6, 2017

19:20:32.543 [info]  FindUsedModules took: 2263
19:20:32.894 [info]  FindUsedFunctions took: 351
19:20:33.638 [info]  Translate took: 744
19:20:34.236 [info]  Output took: 598
19:20:34.249 [info]  Compile took: 3970

Current compilation step times in milliseconds. This is not counting the time spent inside elixir compiler so add an extra 1-2 seconds.

Why is output step taking so long? half the time is the cost of modules = ElixirScript.State.list_modules(pid)

@bryanjos
Copy link
Collaborator Author

bryanjos commented Sep 6, 2017

It could be related to how the state is stored. It's possible that step will be slowest because it does the loading of modules for most of modules being compiled

@bryanjos bryanjos added this to the 0.31.0 milestone Sep 7, 2017
@bryanjos bryanjos removed this from the 0.31.0 milestone Sep 20, 2017
@bryanjos bryanjos added this to the 0.32.0 milestone Oct 21, 2017
@bryanjos bryanjos removed this from the 0.32.0 milestone Nov 7, 2017
@bryanjos
Copy link
Collaborator Author

bryanjos commented Nov 7, 2017

Closing this in favor of #438 which is a bit more directed

@bryanjos bryanjos closed this as completed Nov 7, 2017
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