czardas Posted September 3, 2013 Share Posted September 3, 2013 Is there some overhead to my programs, perhaps making them run slow or inefficient in some meaningful way? If you have infinite RAM then no, otherwise yes. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
TheSaint Posted September 3, 2013 Share Posted September 3, 2013 (edited) If you have infinite RAM then no, otherwise yes. The term "infinite" here, is surely subjective. I for instance, are using older hardware by today's standards. That means 1Gb of RAM in my Win7 netbook. 2.5 Gb of RAM in my WinXP SP3 laptop. 1Gb of RAM in my older WinXP SP3 Intel Desktop. I have 4Gb of RAM in my (not working) WinXP SP3 AMD Desktop, but only 3.x of that is useable. Except for the last year or so, all my programs were designed on the AMD Desktop, but deployed to most of the others, except the Netbook, where I only use a handful of them. The rest since then, are designed on the Laptop and deployed the same. Other than speed to load things like ListViews, File reading, Folder parsing, etc, I do not ever recall any RAM related issues, and any speed differences, I've always attributed to the difference in RAM and Processors. EDIT So how much RAM overhead are we talking, because my programs are riddled with variables, and I even declare every Control created as Global? (Yes, that even means Labels and Groups ... I don't discriminate.) P.S. I've got some very large programs, that do a lot of stuff. Edited September 3, 2013 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
czardas Posted September 3, 2013 Share Posted September 3, 2013 (edited) The infinite RAM thing was a joke. Even so, any finite usage of infinite RAM will never degrade performance in any way. Since infinite RAM is not available there will always be an overhead. I tend to try and squeeze out every last drop of juice out of the tank, so I avoid globals wherever possible. Edited September 3, 2013 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
TheSaint Posted September 3, 2013 Share Posted September 3, 2013 The infinite RAM thing was a joke. Even so, any finite usage of infinite RAM will never degrade performance in any way. Since infinite RAM is not available there will always be an overhead. I tend to try and squeeze out every last drop of juice out of the tank, so I avoid globals wherever possible. Point taken. So at the end of the day, it is a matter of choice, unless one is pedantic about being politically correct with their programming? Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
czardas Posted September 3, 2013 Share Posted September 3, 2013 (edited) I would say it's more a matter of intended purpose. Using globals for everything might seem to make coding easier, but it also carries a penalty and is less reliable. It does reduce the number of parameters to be passed to functions because these variables are always available, and this can be useful. Most of the time you don't need to use globals, and multiple parameters can be passed in an array. Edited September 3, 2013 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
TheSaint Posted September 3, 2013 Share Posted September 3, 2013 Actually, I'd forgotten that I do pass a few around by Function parameters too. Penalty ... Less Reliable .... that sounds painful, but like I said previously, I've seen no evidence. My stance, is that in the majority of cases, if you don't need to think about scope, you can devote more time and thus speed to the rest of your coding. And while that might seem like a small or foolish saving to some, that is not the only area I apply that type of thinking to, so they all add up. All that said, I'm always willing to change my habits, given sufficiently supported reason to. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
czardas Posted September 3, 2013 Share Posted September 3, 2013 (edited) Well firstly, a variable that is always available can accidentally be modified, potentially causing more bugs, unless you declare them as constants. Secondly someone else might want to use your code but finds that there are name conflicts because of all the globals used. Then there's the overhead. There are other reasons I'm not so sure about. That's three strikes already. Edited September 3, 2013 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
TheSaint Posted September 3, 2013 Share Posted September 3, 2013 (edited) Well, if one approaches things just right, I'm not sure they are a cause for concern. The second thing you mentioned especially, unless you are talking about an Include or UDF ... where even I would approach things differently. Anyone foolish enough, to use someone else's variables amongst their own general code, without checking for possible conflicts, only gets what they deserve. In a UDF/Include I would go to great lengths to avoid using Global, and my variables would have a specific naming convention, as used by many here. In general coding, it is my habit and belief to keep variable names simple, so that you have no chance of conflicting with those inside UDF's etc ... providing those creating the UDF's etc stick by similar rules/guidelines. Edited September 3, 2013 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
czardas Posted September 3, 2013 Share Posted September 3, 2013 Anyone foolish enough, to use someone else's variables amongst their own general code, without checking for possible conflicts, only gets what they deserve. And just suppose you wish to embed a smallish sample into a 10000 line script, you may need to rename all the conflicting variables. Perhaps you miss one and the bug does not show up for six months after your product appears on the market. Yes anyone foolish enough might do that. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
TheSaint Posted September 3, 2013 Share Posted September 3, 2013 (edited) And just suppose you wish to embed a smallish sample into a 10000 line script, you may need to rename all the conflicting variables. Perhaps you miss one and the bug does not show up for six months after your product appears on the market. Yes anyone foolish enough might do that. If you are only embedding a smallish sample, how hard is it to check for instances in that, in the bigger program? It's really not that hard to use Search ... and not that different to adding your own new variables into your big program. SciTE can be your friend in this regard too. You always run the risk of bugs when you import stuff into an existing program, that's just the nature of programming. You just need to be diligent in the way you do it ... like most things in life. P.S. It's no different really, than having snippets that you store away and need to modify to suit. Edited September 3, 2013 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
czardas Posted September 3, 2013 Share Posted September 3, 2013 (edited) It's no different really, than having snippets that you store away and need to modify to suit. It's much better to have snippets that work out of the box. Edited September 3, 2013 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
TheSaint Posted September 3, 2013 Share Posted September 3, 2013 It's much better to have snippets that work out of the box. Very true, and I would use a different naming convention for them again .... and different to UDF, etc. But I bet all your snippets aren't like that? If they are, then you've just doubled my respect for you ... which was pretty high anyway. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
czardas Posted September 3, 2013 Share Posted September 3, 2013 Well thanks the feeling is mutual, and the answer is no my functions don't all work out of the box. I generally try to do that. Most of the stuff >here I'm fairly satisfied with. TheSaint 1 operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
TheSaint Posted September 3, 2013 Share Posted September 3, 2013 I've always wanted to be that organized, but Life just gets in the way. It's like most things I guess ... when you don't know enough and perhaps have the opportunity to start things off in the best manner, you don't often even conceive the benefit. Later on, it's a lot more hard work. And then, things happen too. I was better organized with my programming in years gone by, and had my main Desktop PC (now dead) set up for my programming very well. When it died, and I transferred my work environment to the Laptop, I had enough on my plate, that spending the time to remember and replicate what I had on the PC, just proved too big for my drive ... and time. I'd had SciTE setup perfectly and my Toolbar For Any program, plus Snippet access and several other things. I've still not got back to that, and to be fair to me, the Laptop was supposed to be very short term and temporary, which it hasn't proved to be. Oops, I was bout to carry on there, with a word wall no doubt, but just remembered where I was. Perhaps Melba23 or other MOD, might want to split this discussion about Declarations & Scope off onto a Chat topic? With a reference link at both ends. czardas 1 Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
czardas Posted September 3, 2013 Share Posted September 3, 2013 Perhaps Melba23 or other MOD, might want to split this discussion about Declarations & Scope off onto a Chat topic? With a reference link at both ends. Hmm maybe, this is my last responce here, so I don't really see the need. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
TheSaint Posted September 3, 2013 Share Posted September 3, 2013 Perhaps so , but others when they get to see latest posts, might want to put me in the crosshairs. czardas 1 Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now