Line_pro­filer

OpenSource For You - - LET'S TRY DEVELOPERS -

Now let us look at the Oine_ProfiOer lLbrary. F3rR­filH Pay bH finH anG GanGy IRr SrRMHFWs wKHrH yRu nHHG a brLHI RvHrvLHw of which func­tions are slow­ing your code down, but what if you want to know which pre­cise line in the func­tion is re­spon­si­ble for the slow­down? Well, here’s a neat tool, known as Oine_ProfiOer. When you in­stall the Oine_ProfiOer li­brary, you gHW a filH Fal­lHG kern­prof.py, wKLFK Ls rHsSRn­sLblH IRr SrR­filLng your code on a line-by-line ba­sis, rather than as an en­tire func­tion. To use Oine_profiOer, firsW GHFRraWH wLWK @profiOe: @pro­file def mult(ma­trix1, ma­trix2): #rest of the code same as the un­op­ti­mised code

Newspapers in English

Newspapers from India

© PressReader. All rights reserved.