[erlang-questions] program to analyse function usage

Rich Morin rdm@REDACTED
Thu Jun 18 17:19:34 CEST 2015


> I'd like to analyse a very large set of Erlang programs to see
> which functions in the standard libraries actually get used.

The definition of "actually get used" is a tricky one.  If my
code references a function (directly or indirectly), but only
calls it in very unusual circumstances, is that of interest?

Incidentally, this question brings to mind the notion of "tree
shaking", as performed by Google's Closure compiler:

  https://developers.google.com/closure/compiler/

The ClojureScript folks use this to eliminate functions from
their generated code sets.  It might be that a similar approach
could be used to optimize the loading of Erlang functions.


> Does anybody have a large collection of erlang modules?

I don't have much to offer except for this tiny list, but I'd
be very interested in knowing about what you find:

  http://wiki.cfcl.com/Projects/Elixir/Erlex/Testing#Code_Bases

Given that disk is basically free in the amounts you'll need, it
might be worthwhile to think about setting up the collection as
a long-term community resource for assorted analytic efforts.


> Failing this I guess I could scrape code from github - is there
> any way to programmatically fetch all erlang modules from github?

I'm pretty sure that there's no single command that would pull
down all of the Erlang modules from GitHub, but there's a REST
API that would let you assemble a list of prospects, download
files, etc:

  https://developer.github.com/v3


> also are there some download limits that I need to be
> aware of - I don't want to get barred from github :-)

Once you have scaled the problem (i.e., assembled a pick list
with size statistics), you might want to contact them with
a detailed question.  Even if it doesn't get a useful response,
you'll have given them fair warning...

  https://github.com/contact?form%5Bsubject%5D=APIv3

-r

 -- 
http://www.cfcl.com/rdm           Rich Morin           rdm@REDACTED
http://www.cfcl.com/rdm/resume    San Bruno, CA, USA   +1 650-873-7841

Software system design, development, and documentation





More information about the erlang-questions mailing list