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

Serge Aleynikov serge@REDACTED
Fri Apr 8 23:56:30 CEST 2016


Hi Richard,

It seems to me that code module would be the proper place for it, since
that detection is directly related to code loading, which in turn could
call the beam_lib's helper functions.

Serge

On Fri, Apr 8, 2016 at 4:42 PM, Richard Carlsson <carlsson.richard@REDACTED
> wrote:

> Hi Serge (and everyone else)! I've actually got an improved version of
> that module change detection (i.e., based on md5) that I was going to clean
> up and submit to OTP as a standard part of the shell. I think the original
> snippets have been drifting around on the interwebs for aeons, and I'm not
> sure who wrote them originally. We've been using them at Klarna forever.
> But we needed something more reliable (that works even if you have made a
> completely new build of every module, but not actually changing more than a
> few), so I started by pushing some patches to OTP that made the md5 of
> loaded modules easily available in module_info. Then based on that I wrote
> an improved shell function like you just did - we've now tried it out for a
> while and found it stable, so it's a good time to push this as well.
>
> I think my only hesitation is where to put the core "module changed"
> functionality if I'm to submit it as part of OTP: the code module?
> beam_lib? somewhere else? Any opinions out there?
>
>         /Richard
>
> 2016-04-08 15:37 GMT+02:00 Serge Aleynikov <serge@REDACTED>:
>
>> ​Thank you!
>>
>> I updated the
>> https://github.com/saleyn/util/blob/master/src/user_default.erl per your
>> suggestion.
>>
>> On Fri, Apr 8, 2016 at 8:54 AM, Björn Gustavsson <bjorn@REDACTED>
>> wrote:
>>
>>> On Fri, Apr 8, 2016 at 2:28 PM, Serge Aleynikov <serge@REDACTED>
>>> wrote:
>>> > 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?
>>>
>>> Yes. Use Mod:module_info(md5) to calculate MD5 for
>>> the loaded module and compare it to beam_lib:md5(Mod).
>>>
>>> Example:
>>>
>>> 13> c:module_info(md5).
>>> <<79,26,188,243,168,60,58,45,34,69,19,222,138,190,214,118>>
>>> 14> beam_lib:md5(code:which(c)).
>>> {ok,{c,<<79,26,188,243,168,60,58,45,34,69,19,222,138,
>>>          190,214,118>>}}
>>>
>>> /Bjorn
>>>
>>
>>
>> _______________________________________________
>> 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/ff9710fd/attachment.htm>


More information about the erlang-questions mailing list