His code is about initialisers.
New generally usually uses malloc which is understandably dog slow.
C++ gives you -loads- of ways to do your own memory allocation if speed is an issue.
Does XCODE .... or is there any way to force or verify this
Re: Does XCODE .... or is there any way to force or verify t
Bit of a piddly small class though - the examples I'm talking about are generally in the 400-1K bytes region (hence also why stack allocation isn't a concern). For a region that size, even rep movsd or similar is about two thirds the performance of SSE memset and a load of straight-line immediate moves would be well under half as well as trashing the icache.tufty wrote:With -Os, we get this:You aren't gonna get much faster than that.Code: Select all
movl $0, (%eax) movl $0, 4(%eax) movl $0, 8(%eax)
If you test a few non-trivial cases, you'll see that generally compilers are pretty awful at this stuff, even MSVC (which, in my experience, is a bit better than gcc, albeit that I haven't looked at gcc object code for a few years).
Initialisation of such large classes can take much longer than the malloc. I've plenty of data to prove that
Re: Does XCODE .... or is there any way to force or verify t
Are you generating code or something?
If initialising vars is taking longer than the malloc you must have hundreds of vars.
You got an example of what you're doing because I just can't see it unless you've some monolithic class with a ludicrous amount of member vars.
If initialising vars is taking longer than the malloc you must have hundreds of vars.
You got an example of what you're doing because I just can't see it unless you've some monolithic class with a ludicrous amount of member vars.
Re: Does XCODE .... or is there any way to force or verify t
Yes, hundreds of member vars.
- gilesgoat
- Sheepie Whore

- Posts: 27258
- Joined: Wed Sep 03, 2003 7:54 am 0
- Location: Monfalcone, Italy
- Contact:
Re: Does XCODE .... or is there any way to force or verify t
3 days and a half I found another "exoterism" I won't even write .. well in short it's only one line of code missing that should set a var to a value in case a flag is set changing a colour.
The line is missing so that coulour never changes, as in fact it should .. on the PC it stays exactly the same because it's never touched.
But someway on the iPad it does .. and I tried various things I'd dare to say ( cause there are other things in the same loop where that colour IS changed and they are all together processed the same identical way and if I change/touch it I can see it changing ) 'the only way it can happen you HAVE to change that value'.
This is really bizzarre ...
The line is missing so that coulour never changes, as in fact it should .. on the PC it stays exactly the same because it's never touched.
But someway on the iPad it does .. and I tried various things I'd dare to say ( cause there are other things in the same loop where that colour IS changed and they are all together processed the same identical way and if I change/touch it I can see it changing ) 'the only way it can happen you HAVE to change that value'.
This is really bizzarre ...
Giles the billy goat
"Baa"
"Baa"