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

Richard Carlsson carlsson.richard@REDACTED
Mon Nov 28 14:57:15 CET 2016


Well, that took a while, but this has now been merged:
https://github.com/erlang/otp/pull/1257

        /Richard

2016-04-08 22:42 GMT+02:00 Richard Carlsson <carlsson.richard@REDACTED>:

> 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/20161128/23be3e0a/attachment.htm>


More information about the erlang-questions mailing list