Operator ':?' <--
#10

Quote:
Originally Posted by Y_Less
View Post
Better question, why? You clearly have code that works, shortening it will not make it "more efficient" (whatever people think that means) and will just make the code harder to read.
Have you tested it yet? I had faster results on
pawn Code:
toggle = !toggle;
than on
pawn Code:
toggle = toggle ? false : true;
to be excact:
Code:
[02:45:40]  Starting benchmark test with 3 tests each method with 1000000 loops...
[02:45:40]  Toggler - "ternary operator" the 1.
[02:45:40]  1. result of ternary operator toggling: 99 ms
[02:45:40]  Toggler - "ternary operator" the 2.
[02:45:41]  2. result of ternary operator toggling: 99 ms
[02:45:41]  Toggler - "ternary operator" the 3.
[02:45:41]  3. result of ternary operator toggling: 99 ms
[02:45:41]  Toggler - "equals not" the 1.
[02:45:41]  1. result of equals not toggling: 84 ms
[02:45:41]  Toggler - "equals not" the 2.
[02:45:41]  2. result of equals not toggling: 84 ms
[02:45:41]  Toggler - "equals not" the 3.
[02:45:41]  3. result of equals not toggling: 84 ms
[02:45:41]  Benchmark test finished!
Reply


Messages In This Thread
Operator ':?' <-- - by sKgaL - 28.06.2013, 23:17
Re: Operator ':?' <-- - by Djole1337 - 28.06.2013, 23:24
AW: Operator ':?' <-- - by BigETI - 28.06.2013, 23:26
Re: Operator ':?' <-- - by sKgaL - 28.06.2013, 23:35
Re: Operator ':?' <-- - by Jefff - 28.06.2013, 23:43
AW: Operator ':?' <-- - by BigETI - 28.06.2013, 23:44
Re: Operator ':?' <-- - by jamesbond007 - 28.06.2013, 23:48
Re: Operator ':?' <-- - by sKgaL - 29.06.2013, 00:00
Re: Operator ':?' <-- - by sKgaL - 29.06.2013, 00:05
AW: Re: Operator ':?' <-- - by BigETI - 29.06.2013, 00:43

Forum Jump:


Users browsing this thread: 1 Guest(s)