You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2015/09/23 14:29:35 UTC

[41/50] rebar commit: updated refs/heads/import to 5dea85d

Start using memoization server

1. memoize otp release vsn string function call

2. memoize expensive filename:absname/1 call which happens
   to be called quite frequently


Project: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/commit/ec018cf5
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/tree/ec018cf5
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/diff/ec018cf5

Branch: refs/heads/import
Commit: ec018cf5a5f102eb96c0972a0175f74f2016f77c
Parents: 02c4300
Author: Tuncer Ayaz <tu...@gmail.com>
Authored: Thu Jun 11 20:10:27 2015 +0200
Committer: Tuncer Ayaz <tu...@gmail.com>
Committed: Fri Jun 12 12:52:24 2015 +0200

----------------------------------------------------------------------
 src/rebar.erl       |  6 ++++++
 src/rebar_utils.erl | 25 ++++++-------------------
 2 files changed, 12 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-rebar/blob/ec018cf5/src/rebar.erl
----------------------------------------------------------------------
diff --git a/src/rebar.erl b/src/rebar.erl
index b2358c7..dcfb353 100644
--- a/src/rebar.erl
+++ b/src/rebar.erl
@@ -214,6 +214,12 @@ run_aux(BaseConfig, Commands) ->
         {error,{already_started,crypto}} -> ok
     end,
 
+    %% Make sure memoization server is running
+    case rmemo:start() of
+        {ok, _} -> ok;
+        {error, {already_started, _}} -> ok
+    end,
+
     %% Convert command strings to atoms
     CommandAtoms = [list_to_atom(C) || C <- Commands],
 

http://git-wip-us.apache.org/repos/asf/couchdb-rebar/blob/ec018cf5/src/rebar_utils.erl
----------------------------------------------------------------------
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index f1aeef0..b250671 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -237,9 +237,11 @@ prop_check(false, Msg, Args) -> ?ABORT(Msg, Args).
 
 %% Convert all the entries in the code path to absolute paths.
 expand_code_path() ->
-    CodePath = lists:foldl(fun(Path, Acc) ->
-                                   [filename:absname(Path) | Acc]
-                           end, [], code:get_path()),
+    CodePath = lists:foldl(
+                 fun(Path, Acc) ->
+                         Path1 = rmemo:call(filename, absname, [Path]),
+                         [Path1 | Acc]
+                 end, [], code:get_path()),
     code:set_path(lists:reverse(CodePath)).
 
 %%
@@ -403,22 +405,7 @@ patch_env(Config, [E | Rest]) ->
 %% ====================================================================
 
 otp_release() ->
-    %% NOTE: All and any pdict use has been erased from rebar a long
-    %% time ago in a big refactoring, and while extra processes (think
-    %% base_compiler) may have to re-cache the vsn string, this is
-    %% tolerable as an exception. After all, it's a write-once value.
-    %%
-    %% We cache the return of otp_release1, since otherwise, we're
-    %% repeatedly reading the same file off the hard drive and
-    %% generating warnings if they aren't there.
-    case erlang:get(otp_release_cache) of
-        undefined ->
-            Vsn = otp_release1(erlang:system_info(otp_release)),
-            erlang:put(otp_release_cache, Vsn),
-            Vsn;
-        Vsn ->
-            Vsn
-    end.
+    rmemo:call(fun otp_release1/1, [(erlang:system_info(otp_release))]).
 
 %% If OTP <= R16, otp_release is already what we want.
 otp_release1([$R,N|_]=Rel) when is_integer(N) ->