<br><br><div class="gmail_quote">On Mon, Feb 2, 2009 at 3:11 PM, Chris Rebert <span dir="ltr"><<a href="mailto:clp2@rebertia.com">clp2@rebertia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">On Mon, Feb 2, 2009 at 1:29 AM, S.Selvam Siva <<a href="mailto:s.selvamsiva@gmail.com">s.selvamsiva@gmail.com</a>> wrote:<br>
> Hi all,<br>
> I have a small query,<br>
> Consider there is a task A which i want to perform.<br>
><br>
> To perform it ,i have two option.<br>
> 1)Writing a small piece of code(approx. 50 lines) as efficient as possible.<br>
> 2)import a suitable module to perform task A.<br>
><br>
><br>
> I am eager to know,which method will produce best performance?<br>
<br>
</div></div>A. Your question seems much too vague to answer.<br>
B. Premature optimization is the root of all evil. In all likelihood,<br>
the time taken by the `import` will be absolutely trivial compared to<br>
the rest of the script, so don't bother micro-optimizing ahead of<br>
time; write readable code first, then worry about optimization once<br>
it's working perfectly.<br>
<br>
Cheers,<br>
Chris<br>
<font color="#888888">--<br>
Follow the path of the Iguana...<br>
<a href="http://rebertia.com" target="_blank">http://rebertia.com</a></font></blockquote><div><br><br>Thank you Chris,<br><br> I faced a optimization problem as follow,<br><br>For fuzzy string comparison initially i used 15 lines of code which compares a word with 29,000 words in a list .For each set of words compared, the 15-line code produce number of differences characters of the two words.<br>
<br>But when i used python-levenshtein module for same reason it has run faster than the old method.This invoked me to raise that query.<br><br>Now i understood that, it is not an issue of importing the module/writing the code, but the problem must be with my 15-line code.<br>
<br></div></div><br>-- <br>Yours,<br>S.Selvam<br>