https://issues.dlang.org/show_bug.cgi?id=6767
hst...@quickfur.ath.cx changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |hst...@quickfur.ath.cx Resolution|--- |WORKSFORME --- Comment #1 from hst...@quickfur.ath.cx --- This seems to have been fixed in git HEAD. Tested on Linux/64-bit, compile with dmd -O. The function compiles to: ------ 0000000000000000 <_D4test3fooFiZi>: 0: 55 push %rbp 1: 48 8b ec mov %rsp,%rbp 4: 48 83 ec 10 sub $0x10,%rsp 8: 48 81 ff ff 00 00 00 cmp $0xff,%rdi f: 77 0e ja 1f <_D4test3fooFiZi+0x1f> 11: ff 24 fd 00 00 00 00 jmpq *0x0(,%rdi,8) 18: 31 c0 xor %eax,%eax 1a: 48 8b e5 mov %rbp,%rsp 1d: 5d pop %rbp 1e: c3 retq 1f: b8 01 00 00 00 mov $0x1,%eax 24: 48 8b e5 mov %rbp,%rsp 27: 5d pop %rbp 28: c3 retq 29: 0f 1f 80 00 00 00 00 nopl 0x0(%rax) ------ Which is probably close to optimal. At least, it no longer produces the O(n) nastiness. :-) --