| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#101
| |||
| |||
| "Phlip" <phlip_cpp@yahoo.com> wrote in message news:qtz6e.608$nK5.124@newssvr33.news.prodigy.com. .. > William wrote: > > > > - nobody yet reported a global making something faster... > > > > Yes, they did. Global look up tables were mentioned a while > > back. -Wm > > Profiled? In my own work, yes, but it's really a no-brainer. Generating a table of any significant size for a moderately complex function once is hard to beat. (In one case I got a 10x speed up in exchange for a fraction of a second more initialization time.) -Wm |
|
#102
| |||
| |||
| "Gregory L. Hansen" <glhansen@steel.ucs.indiana.edu> wrote in message news:d3ehor$j9a$2@rainier.uits.indiana.edu... > In article <_uWdnQq3c6oHPsffRVn-1g@giganews.com>, > William <Reply@NewsGroup.Please> wrote: > > > >Yes, they did. Global look up tables were mentioned a while > >back. -Wm > > Because it was global, or because it was a look up table? Where's the efficiency in generating the same look up tables repeatedly? -Wm |
|
#103
| |||
| |||
| William wrote: > > >Yes, they did. Global look up tables were mentioned a while > > >back. -Wm > > > > Because it was global, or because it was a look up table? > > Where's the efficiency in generating the same look up tables > repeatedly? -Wm Objects may have a long lifespan without harming design. The worst global is read-write. Wrap globals in language features (such as 'const') that prevent writes. Then they cannot transmit bugs between modules. So emmend my summary: - nobody has seen a global that had to be naked to be efficient -- Phlip http://industrialxp.org/community/bi...UserInterfaces |
|
#104
| |||
| |||
| William wrote: > "Gregory L. Hansen" <glhansen@steel.ucs.indiana.edu> wrote [...] > > William <Reply@NewsGroup.Please> wrote: > > > > > >Yes, they did. Global look up tables were mentioned a while > > >back [as being faster than a local variable] > > > > Because it was global, or because it was a look up table? > > Where's the efficiency in generating the same look up tables > repeatedly? -Wm That translates as `because it was a look-up table.' Antony |
|
#105
| |||
| |||
| In article <SxR6e.759$bc2.212@newssvr17.news.prodigy.com>, phlip_cpp@yahoo.com says... > So emmend [sic] my summary: > > - nobody has seen a global that had to be naked > to be efficient In <115ludqq2ld0b6d@corp.supernews.com> "CTips" posted a very good example of where a global variable solution would not exhibit the aliasing problem of an encapsulated solution and therefore the former would be (potentially vastly) faster. It's well-known that higher levels of abstraction are detrimental to execution speed in languages that exhibit aliasing due to missed compiled optimizations. So, in short, your summary is crap. Why are you harping on about this? -- Christer Ericson http://realtimecollisiondetection.net/ |
|
#106
| |||
| |||
| Phlip wrote: > William wrote: > >>>> Yes, they did. Global look up tables were mentioned a while >>>> back. -Wm >>> >>> Because it was global, or because it was a look up table? >> >> Where's the efficiency in generating the same look up tables >> repeatedly? -Wm > > Objects may have a long lifespan without harming design. > > The worst global is read-write. Wrap globals in language features > (such as 'const') that prevent writes. Then they cannot transmit > bugs between modules. You can't do that cleanly if you have to write initialization code to set the table up. -- "If you want to post a followup via groups.google.com, don't use the broken "Reply" link at the bottom of the article. Click on "show options" at the top of the article, then click on the "Reply" at the bottom of the article headers." - Keith Thompson |
|
#107
| |||
| |||
| On Tue, 12 Apr 2005, CBFalconer wrote: > Phlip wrote: >> The worst global is read-write. Wrap globals in language features >> (such as 'const') that prevent writes. Then they cannot transmit >> bugs between modules. > > You can't do that cleanly if you have to write initialization code > to set the table up. > Depends on your language - it works fine under lazy evaluation, for example. -- flippa@flippac.org Ivanova is always right. I will listen to Ivanova. I will not ignore Ivanova's recomendations. Ivanova is God. And, if this ever happens again, Ivanova will personally rip your lungs out! |
|
#108
| |||
| |||
| Philippa Cowderoy wrote: > CBFalconer wrote: > > > Phlip wrote: > >> The worst global is read-write. Wrap globals in language features > >> (such as 'const') that prevent writes. Then they cannot transmit > >> bugs between modules. > > > > You can't do that cleanly if you have to write initialization code > > to set the table up. > > Depends on your language - it works fine under lazy evaluation, for > example. In C++, the object could easily be 'const': BigTable const globalTable(parameters); int main() { game(); } 'const' engages after construction time. (Warning: Before main() starts, using globalTable generates undefined behavior.) -- Phlip http://industrialxp.org/community/bi...UserInterfaces |
|
#109
| |||
| |||
| On Tue, 12 Apr 2005, Phlip wrote: > Philippa Cowderoy wrote: > >> CBFalconer wrote: >> >>> Phlip wrote: >>>> The worst global is read-write. Wrap globals in language features >>>> (such as 'const') that prevent writes. Then they cannot transmit >>>> bugs between modules. >>> >>> You can't do that cleanly if you have to write initialization code >>> to set the table up. >> >> Depends on your language - it works fine under lazy evaluation, for >> example. > > In C++, the object could easily be 'const': > > BigTable const globalTable(parameters); > <snip> > 'const' engages after construction time. > *smacks forehead* Spot who's not written any serious C++ recently? Though initialisation order makes a potential thorn in the side for some purposes there. It makes rather a lot of sense that const can't prevent construction though, value objects are kinda useless otherwise. -- flippa@flippac.org 'In Ankh-Morpork even the shit have a street to itself... Truly this is a land of opportunity.' - Detritus, Men at Arms |
|
#110
| |||
| |||
| Philippa Cowderoy wrote: > > BigTable const globalTable(parameters); > > > <snip> > > 'const' engages after construction time. > > *smacks forehead* > > Spot who's not written any serious C++ recently? Though initialisation > order makes a potential thorn in the side for some purposes there. I originally wrote "but don't use the global before main()," but erased it as too pedantic. Who renders frames before main()? Who in C++ doesn't know not to depend on the order of initialization of objects before main()? You really want me to go into pure hand-holding mode here? -- Phlip http://industrialxp.org/community/bi...UserInterfaces |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.