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

PICCORO McKAY Lenz mckaygerhard at ...626...
Tue Nov 5 16:30:04 CET 2013


From: Sebastian Kulesz <sebikul at ...626...>
>> Why not simply write benchmark?
how tipycally geek-like response, well Sebastian has the right
response lest explaint more:
>>
>
> A benchmark wouldn't be accurate, as it will be IO bound, and being an old
of course, the benchmark software will run in same machine (the only
case possible) for tests, so then this implice extra I/O and also
extra CPU cycles.. jeje
> 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.
of course, but the code of if-else logic of gambas will improve the answer,
if code of if-else combined with the disk write verify (a simple ls
shell no complicated gambas focused function) has less cycles rather
than the try-catch, then if-else are more
faster ..

of course, assuming the write access, if only interest the verification the
if-else its so far the most faster..

but:
> 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 ...>
that's the real true!
> will access the disk at least n and at most 2n. 3n at most if you check for
> write permissions.

in  any cae, i have some test, simple, 120 threath trying to do the
same action, in bot cases, and the if-else are more faster, of course,
assuming write-access enabled!

the right usage are the try-catch, the faster are if-else




More information about the User mailing list