Re: [swift-users] Why are Swift Loops slow?

2016-10-12 Thread Gerriet M. Denkmann via swift-users
> On 12 Oct 2016, at 23:05, Joe Groff via swift-users > wrote: > >> >> On Oct 12, 2016, at 2:25 AM, Gerriet M. Denkmann via swift-users >> wrote: >> >> uint64_t nbrBytes = 4e8; >> uint64_t count = 0; >> for( uint64_t byteIndex = 0; byteIndex < nbrBytes; byteIndex++ ) >> { >> count += b

Re: [swift-users] Why are Swift Loops slow?

2016-10-12 Thread Andrew Trick via swift-users
> On Oct 12, 2016, at 9:05 AM, Joe Groff via swift-users > wrote: > > It looks like LLVM does not recognize the overflow traps Swift emits on > arithmetic operations as dead code, so that prevents it from completely > eliminating the Swift loop. That's a bug worth fixing in Swift, but unlike

Re: [swift-users] Why are Swift Loops slow?

2016-10-12 Thread Joe Groff via swift-users
> On Oct 12, 2016, at 2:25 AM, Gerriet M. Denkmann via swift-users > wrote: > > uint64_t nbrBytes = 4e8; > uint64_t count = 0; > for( uint64_t byteIndex = 0; byteIndex < nbrBytes; byteIndex++ ) > { > count += byteIndex; > if ( ( byteIndex & 0x ) == 0 ) { count += 1.3; } (AA

Re: [swift-users] Why are Swift Loops slow?

2016-10-12 Thread Greg Parker via swift-users
> On Oct 12, 2016, at 2:25 AM, Gerriet M. Denkmann via swift-users > wrote: > > uint64_t nbrBytes = 4e8; > uint64_t count = 0; > for( uint64_t byteIndex = 0; byteIndex < nbrBytes; byteIndex++ ) > { > count += byteIndex; > if ( ( byteIndex & 0x ) == 0 ) { count += 1.3; } (AA

[swift-users] Why are Swift Loops slow?

2016-10-12 Thread Gerriet M. Denkmann via swift-users
uint64_t nbrBytes = 4e8; uint64_t count = 0; for( uint64_t byteIndex = 0; byteIndex < nbrBytes; byteIndex++ ) { count += byteIndex; if ( ( byteIndex & 0x ) == 0 ) { count += 1.3; } (AAA) }; Takes 260 msec. Btw.: Without the (AAA) line the whole loop is done in 10 μsec. A