Skip to main content
7 events
when toggle format what by license comment
Sep 12, 2016 at 18:07 comment added Captain Man @LakshanSivananthan added a couple more suggestions
Sep 12, 2016 at 18:05 history edited Captain Man CC BY-SA 3.0
Add more
Sep 12, 2016 at 15:14 comment added Captain Man @LakshanSivananthan Even if it is less performant in some tiny way I really wouldn't worry about it. This code is not going to be "mission critical". If your code is "fast enough" then it's as fast as it needs to be, only once it's too slow would I consider trying to speed it up and worry about little things like that. I mean, we should always try to use fast algorithms and not go into multiple loops for no reason, but worrying about where a variable is declared isn't going to save you but a few nanoseconds -- if even.
Sep 12, 2016 at 15:05 comment added Lakshan Sivananthan That was a great answer, thank you very much for your feedback @Captain Man. I agree with returning a variable instead of just printing to console. I just thought it would be more efficient not to create a new variable for this. Same with putting the two variables buffer and translated inside the loop, it will recreate these two variables for every loop right? I figured that would be expensive, or at least less efficient. What do you think ?
Sep 12, 2016 at 15:04 history edited Captain Man CC BY-SA 3.0
added 93 characters in body
Sep 12, 2016 at 15:02 vote accept Lakshan Sivananthan
Sep 12, 2016 at 14:57 history answered Captain Man CC BY-SA 3.0