You'd think that, but try{ do{ i += readline()+"\n" }while(true)
}catch(e){};
is a few % *slower* every time for me (2,500,000 line input to stdin) than
do{ try{ i += readline() + "\n" }catch(e){ break }}while(true)
On Wed, Sep 2, 2009 at 10:53 PM, Abdulla Kamar <[email protected]>wrote:
> Well in terms of semantics, it's not the correct thing to do (throw when
> reaching the end of file). Other than that, Isaac was saying that it's
> incorrect for the benchmarks - and I would add that it could also cause the
> benchmarks to show incorrect timings due to exception handling overhead.
>
>
> On Thu, Sep 3, 2009 at 1:46 PM, <[email protected]> wrote:
>
>> I disagree.. how is it holding it up? What's wrong with wrapping
>> readline() in try/catch, as I did in
>> http://shootout.alioth.debian.org/u32/benchmark.php?test=regexdna&lang=all
>>
>> (where, incidentally, JavaScript V8 beats all other implementations)
>>
>>
>> http://codereview.chromium.org/173262
>>
>
>
>
> --
> Thank you
> Abdulla
>
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---