I had read joel's article:Parsing text and binary files with Erlang. In the article, the author show how to parse a comma-delimited text file. <br>I write the code for practice, the module source is act.erl. By the way, I see in the bottom of joel' article, a buddy give a comment, he says, he use binary to instead of some list, It seems so efficient, so I write the second code, it's act_2.erl.<br>
<br>Finally, I want to test how much the act_2 faster than act. So suprise, In my Compute, The result is :<br>96> timer_avg:tc(act, parse, ["test.txt"], 100).<br>Max: 15991<br>Min: 1<br>Avg: 2339.05<br><br>100> timer_avg:tc(act_2, parse, ["test.txt"], 100).<br>
Max: 15997<br>Min: 1<br>Avg: 4839.03<br><br>the timer_avg is a moudule evaluates <span class="code">apply(Module, Function, Arguments)</span> N times and measures
the elapsed real time, about Max, Min, Avg. (use timer:tc/3).<br><br>who will give me some explain?<br><br><br><br>