[Gambas-user] if-else vs try who are best faster in machine time?

Sebastian Kulesz sebikul at ...626...
Tue Nov 5 00:37:51 CET 2013


On Mon, Nov 4, 2013 at 6:43 PM, Jussi Lahtinen <jussi.lahtinen at ...626...>wrote:

> Why not simply write benchmark?
>

A benchmark wouldn't be accurate, as it will be IO bound, and being an old
machine, better reduce disk IO than CPU usage (I'm guessing it uses IDE
drives; which have low access time too). Besides, first option can fail if
you don't have write access to the file, thus needing a third access to
check for permission to delete. Better use Try and catch the Error; let me
explain:

If you want to analyze the access to disk, the Try/Catch will access n
times the disk, n the amount of files. The <If Exist(...) Then Kill ...>
will access the disk at least n and at most 2n. 3n at most if you check for
write permissions.

Anyway, that's my opinion ;)


>
> Jussi
>
>
> On Mon, Nov 4, 2013 at 11:30 PM, PICCORO McKAY Lenz
> <mckaygerhard at ...626...>wrote:
>
> > i have  several I/O write and i wish to know what its the best choice:
> >
> > 1) If Exist(ruta_img_foto) Then Kill ruta_img_foto
> >
> > or
> >
> > 2) Try Kill ruta_img_foto
> >
> > of course, maybe depends of how the if-else works respect the try logic!
> >
> > please, i need this info, i use low end machines like daruma's !!!!
> > (512Mb ram, and 800MHz cpu)
> >
> > --
> > Lenz McKAY Gerardo (PICCORO)
> > http://qgqlochekone.blogspot.com
> >
> >
> >
> ------------------------------------------------------------------------------
> > Android is increasing in popularity, but the open development platform
> that
> > developers love is also attractive to malware creators. Download this
> white
> > paper to learn more about secure code signing practices that can help
> keep
> > Android apps secure.
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
>
> ------------------------------------------------------------------------------
> Android is increasing in popularity, but the open development platform that
> developers love is also attractive to malware creators. Download this white
> paper to learn more about secure code signing practices that can help keep
> Android apps secure.
> http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list