I'm a newbie, sorry if this has been asked before but I couldn't find 
anything.

Currently, elixir uses last modification dates to determine files that need 
to be recompiled.

```
$ mix compile
# ...
$ touch lib/some/file.ex
$ mix compile
Compiling <n> files (.ex)
```

Could Elixir not verify that in addition to a modification time change, 
that the actual text content has changed by comparing a hash of it? In the 
example above, the file `lib/some/file.ex` would be hashed a second time, 
but no recompilation would occur.

Currently, many operations may change the last modification date even if no 
content at all has changed:
* switch to a different branch, switch back
* do an interactive rebase:
  - to rewrite a commit message,
  - to reorder some commits
  - to squash some commits together
  - etc.

While the content of the files does not change (at all) in these examples, 
some very long recompilations may occur because elixir only relies only on 
modification times and not on file hashes.
Hashing a file is orders of magnitude faster than compiling it, and 
realizing that the potentially large number of compile-time dependencies of 
a given file do not need to be recompiled is infinitely faster than 
recompiling them all for nothing.

I am presuming that hash collisions are deemed so incredible unlikely to be 
acceptable, but if not, then I'd ask the same question but with using the 
complete content of the source file instead of a hash of it. Copying a 
source file is again an order of magnitude faster than the time it takes to 
recompile it.

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/e7a68d8d-0102-483d-a4ec-58849eb88ef6n%40googlegroups.com.

Reply via email to