July 26, 2012 Re: Computed gotos on Reddit | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry Olshansky | On 7/26/2012 1:14 PM, Dmitry Olshansky wrote:
> Obviously it's backwards and awful. Makes me wonder why can't we take it
> directly, what's limitation ?
> How about allowing it, at least in inline assembly?
It can be done, it's just that nobody has done the implementation in the inline assembler.
|
July 26, 2012 Re: Computed gotos on Reddit | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry Olshansky | On 7/26/2012 8:55 AM, Dmitry Olshansky wrote: >> int test(int i) >> { >> switch (i) >> { >> case 3: i += 3; break; >> case 4: i += 4; break; >> case 5: i += 5; break; >> case 6: i += 6; break; >> case 7: i += 7; break; >> case 8: i += 8; break; >> default: i += 100; break; >> } >> return i; >> } >> > > Do the above in loop. And more cases of course. Something around 40 should do. Here's my entire test program. It runs a consistent 5 to 10% slower with the new method compared with the old. Color me very disappointed. ======================================================= import core.stdc.stdio; int test(int i) { switch (i) { case 3: i += 3; break; case 4: i += 4; break; case 5: i += 5; break; case 6: i += 6; break; case 7: i += 7; break; case 8: i += 8; break; default: i += 100; break; } return i; } void main() { for (int i = 0; i < 100000000; i++) { for (int j = 0; j < 10; j++) test(j); } printf("%d\n", test(6)); } |
July 26, 2012 Re: Computed gotos on Reddit | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 27-Jul-12 00:31, Walter Bright wrote: > On 7/26/2012 1:14 PM, Dmitry Olshansky wrote: >> Obviously it's backwards and awful. Makes me wonder why can't we take it >> directly, what's limitation ? >> How about allowing it, at least in inline assembly? > > It can be done, it's just that nobody has done the implementation in the > inline assembler. > > Great! I guess I should file another enhancement request? -- Dmitry Olshansky |
July 26, 2012 Re: Computed gotos on Reddit | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 27-Jul-12 00:38, Walter Bright wrote: > On 7/26/2012 8:55 AM, Dmitry Olshansky wrote: >>> int test(int i) >>> { >>> switch (i) >>> { >>> case 3: i += 3; break; >>> case 4: i += 4; break; >>> case 5: i += 5; break; >>> case 6: i += 6; break; >>> case 7: i += 7; break; >>> case 8: i += 8; break; >>> default: i += 100; break; >>> } >>> return i; >>> } >>> >> >> Do the above in loop. And more cases of course. Something around 40 >> should do. > > > Here's my entire test program. It runs a consistent 5 to 10% slower with > the new method compared with the old. Color me very disappointed. Thanks. I'll play with it a bit if time permits. -- Dmitry Olshansky |
July 26, 2012 Re: Computed gotos on Reddit | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry Olshansky | On 27-Jul-12 00:50, Dmitry Olshansky wrote: > On 27-Jul-12 00:31, Walter Bright wrote: >> On 7/26/2012 1:14 PM, Dmitry Olshansky wrote: >>> Obviously it's backwards and awful. Makes me wonder why can't we take it >>> directly, what's limitation ? >>> How about allowing it, at least in inline assembly? >> >> It can be done, it's just that nobody has done the implementation in the >> inline assembler. >> >> > Great! I guess I should file another enhancement request? > Filed: http://d.puremagic.com/issues/show_bug.cgi?id=8448 -- Dmitry Olshansky |
July 26, 2012 Re: Computed gotos on Reddit | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry Olshansky | On 7/26/2012 2:17 PM, Dmitry Olshansky wrote:
> Filed: http://d.puremagic.com/issues/show_bug.cgi?id=8448
Thank you.
|
Copyright © 1999-2021 by the D Language Foundation