yes, I retry the test like you say.<br>the result is same.<br>thank you!<br><br><div class="gmail_quote">2008/6/26 Vlad Dumitrescu <<a href="mailto:vladdu55@gmail.com">vladdu55@gmail.com</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi<br><br><div class="gmail_quote">2008/6/26 litao cheng <<a href="mailto:litaocheng@gmail.com" target="_blank">litaocheng@gmail.com</a>>:<div><div></div><div class="Wj3C7c"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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>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></blockquote></div></div></div><br>You might want to retry the tests, starting them instead with<br>spawn(timer_avg, tc, [act, parse, ["test.txt"], 100]).<br>
spawn(timer_avg, tc, [act_2, parse, ["test.txt"], 100]).<br>
<br>This way you don't get any random garbage collections to interfere.<br><br>regards,<br><font color="#888888">Vlad<br>
</font></blockquote></div><br>