[erlang-questions] Feedback wanted: Remove compilation times from BEAM files in OTP 19?

Serge Aleynikov serge@REDACTED
Fri Apr 8 14:28:36 CEST 2016


I've been relying on module's compilation time for figuring out the changed
modules (see below).

In the absence of {time, CompileTime}, would there be a way to determine
the modification time stamp of the file at the time it was loaded by code
loader?

Serge

modified_modules() ->
    [M || {M, _} <-  code:all_loaded(), module_modified(M) == true].

module_modified(Module) ->
    case code:is_loaded(Module) of
    {file, preloaded} ->
        false;
    {file, Path} ->
        CompileOpts = proplists:get_value(compile, Module:module_info()),
        CompileTime = proplists:get_value(time, CompileOpts),
        Src = proplists:get_value(source, CompileOpts),
        module_modified(Path, CompileTime, Src);
    _ ->
        false
    end.

module_modified(Path, PrevCompileTime, PrevSrc) ->
    case find_module_file(Path) of
    false ->
        false;
    ModPath ->
        {ok, {_, [{_, CB}]}} = beam_lib:chunks(ModPath, ["CInf"]),
        CompileOpts =  binary_to_term(CB),
        CompileTime = proplists:get_value(time, CompileOpts),
        Src = proplists:get_value(source, CompileOpts),
        not (CompileTime == PrevCompileTime) and (Src == PrevSrc)
    end.


On Fri, Apr 8, 2016 at 6:32 AM, Björn Gustavsson <bjorn@REDACTED> wrote:

> As long as anyone can remember, the compilation time has been included
> in BEAM files (and can be retrieved using module_info()).
>
> As far as I know, the inclusion of the time has only caused problems.
> I can't remember that anyone has found any use for the compilation
> time.
>
> So if we decide to remove the compilation time by default in OTP 19...
>
> ... would it cause any problem for someone in some workflow?
>
> ... would we need an option to include the compilation time?
>
> /Bjorn
>
> --
> Björn Gustavsson, Erlang/OTP, Ericsson AB
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160408/914c9a4f/attachment.htm>


More information about the erlang-questions mailing list