nickva commented on issue #505: Enable tail call optimization in couch_replicator_docs URL: https://github.com/apache/couchdb/pull/505#issuecomment-299054310 @davisp pointed out that current code already has TCO and this is not needed Used this script from him (with a modification to just print the memory of the process) to verify: ``` -module(foo). -compile(export_all). a() -> a(0). a(I) -> if (I+1) rem 1000 /= 0 -> ok; true -> io:format("~p~n", [process_info(self(), memory)]) end, try throw(bar) catch throw:bar -> c(a, I+1) end. b() -> b(0). b(I) -> if (I+1) rem 1000 /= 0 -> ok; true -> io:format("~p~n", [process_info(self(), memory)]) end, try c(b, I+1) catch throw:bar -> foo end. c(F, I) -> ?MODULE:F(I). ``` foo:b() ends up producing ``` ... {memory,102684144} {memory,102684144} {memory,102684144} {memory,102684144} ``` foo:a() is stable ``` ... {memory,16672} {memory,24576} {memory,11784} {memory,16672} ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
With regards, Apache Git Services
