Hi All,
I was wondering if there is any effect if the code is optimized with getting rid of all the returns, loose spaces and more. Will this make things faster? will it allow more things to be done. or is it no issue so coding should be clean.
Just wondering, in the old days of little mem we used to optimize the code i dont know if this is needed.
Sorry for the noob question
Mike
CODE SIZE
-
- Posts: 79
- Joined: Tue Dec 01, 2020 8:50 am
CODE SIZE
Building a home Cessna 172SP Steam. X-plane/MFS2020
(ex Name on Airmanager forum Polarair)
(ex Name on Airmanager forum Polarair)
Re: CODE SIZE
Yes code can still be optimised. However removing spaces or return lines from the text editor will not speed things up. They are only there to make it easier for us humans to read and deciper. Only what gets executed will have an effect on performance. So doing something in 10 lines when it could be achieved in one line will take longer to execute. For you to notice the performace hit on PC hardware though it generally needs one or some of the following things. With lesser hardware such as the Rpi these factors become more important because it struggles at the best of times, let alone with these factors at play.
A lot of code
A lot of data
A lot of iteration
A lot of code
A lot of data
A lot of iteration
Air Manager panels at https://www.experimentalsimavionics.com
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Re: CODE SIZE
Hi Mike,Mike Horsten wrote: ↑Fri Feb 19, 2021 11:28 am Hi All,
I was wondering if there is any effect if the code is optimized with getting rid of all the returns, loose spaces and more. Will this make things faster? will it allow more things to be done. or is it no issue so coding should be clean.
Just wondering, in the old days of little mem we used to optimize the code i dont know if this is needed.
Sorry for the noob question
Mike
The best code - really - for AM on a PC, is one that YOU can read and understand. Even if it is not #optimised# .
However 'good' one is at programming, looking at code written 6 months before can be totally bewildering
Best advice is to comment, and then to comment, and then to comment more.
Get it to work,
then, if it is needed - debateable - then you could try to optimise it. Even if you choose this route - the three rules are - comment, comment, comment.
There are some amazingly good 'technical' programmers here. However, I see little commenting which is extremely bad practice (imho of course).
Commenting all the way though - including code that doesn't work and has been hashed out - is excellent.
One difference I Note between, for example, the Arduino community and the AM community is that Arduino tends to have amazing support and comments etc, whereas, AM does not.
However, a lot can be learned from looking at other's code.
Superbly written and optimised code becomes moot when it is not commented.
The fully commented - NON optimised code wins every time.
Joe.
Joe. CISSP, MSc.
-
- Posts: 79
- Joined: Tue Dec 01, 2020 8:50 am
Re: CODE SIZE
Thanks to both, Comments, and i will comment comment and use the comment to document my work.
Mike
Mike
Building a home Cessna 172SP Steam. X-plane/MFS2020
(ex Name on Airmanager forum Polarair)
(ex Name on Airmanager forum Polarair)
Re: CODE SIZE
Nice one MIkeMike Horsten wrote: ↑Fri Feb 19, 2021 1:51 pm Thanks to both, Comments, and i will comment comment and use the comment to document my work.
Mike
Joe. CISSP, MSc.