|
|
Home » Developing U++ » U++ Developers corner » Proposed change to U++ to allow owning children.
Re: Proposed change to U++ to allow owning children. [message #31670 is a reply to message #31662] |
Sat, 19 March 2011 10:59 |
|
mirek
Messages: 13980 Registered: November 2005
|
Ultimate Member |
|
|
Lance wrote on Fri, 18 March 2011 20:30 | Thank you for giving it a try.
I was surprised to know there was actually a speed penalty. Maybe that's because of the for loop. Some really smarter compiler will tranlsate the for loop to movsb, movsw, movsdw, etc, then the for loop will no longer pose a speed penalty.
|
Nope, they are slightly slower than series of assignments.
Actually, smart compiler might unroll that loop into series of assignments anyway.
Quote: |
I was thinking set bit fields will be slower. Maybe just simple put the bitfields in a union and the whole flags field to 0.
|
Now that would be smarter. Still, compiler are good, I would not be surprised if they replaced those assignements anyway.
Anyway, we are speaking here about negligible impacts on result (this area of code is definitely irrelevant optimization-wise).
But my primary complaint is that the loop is poor choice for quality of code, too error-prone.
Quote: |
Then here in the Draw.h
class Font : AssignValueTypeNo<Font, FONT_V, Moveable<Font> >{
union {
int64 data;
struct {
word face;
word flags;
int16 height;
int16 width;
} v;
};
...
Font() { data=0; } // that's the whole point why
// a union is introduced IMHO
|
Data is used to hash Font value and to compare it too.
Anyway, in any case there are 4 stable fields in union. Such situation is easily manageable.
Ctrl fields are much more numerous and change over time.
|
|
|
|
|
Proposed change to U++ to allow owning children.
By: Lance on Wed, 16 March 2011 17:18
|
|
|
Re: Proposed change to U++ to allow owning children.
By: kohait00 on Wed, 16 March 2011 17:26
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 16 March 2011 17:29
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 16 March 2011 17:30
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 16 March 2011 17:39
|
|
|
Re: Proposed change to U++ to allow owning children.
By: kohait00 on Wed, 16 March 2011 18:01
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 16 March 2011 18:10
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 16 March 2011 18:29
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 16 March 2011 18:35
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 16 March 2011 18:43
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 16 March 2011 19:24
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Fri, 18 March 2011 02:13
|
|
|
Re: Proposed change to U++ to allow owning children.
By: kohait00 on Fri, 18 March 2011 11:01
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Fri, 18 March 2011 14:39
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Fri, 18 March 2011 15:21
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Fri, 18 March 2011 15:40
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Fri, 18 March 2011 16:22
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Fri, 18 March 2011 16:34
|
|
|
Re: Proposed change to U++ to allow owning children.
By: mirek on Fri, 18 March 2011 19:35
|
|
|
Re: Proposed change to U++ to allow owning children.
By: mirek on Fri, 18 March 2011 19:32
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Fri, 18 March 2011 23:02
|
|
|
Re: Proposed change to U++ to allow owning children.
By: mirek on Fri, 18 March 2011 23:18
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Fri, 18 March 2011 23:34
|
|
|
Re: Proposed change to U++ to allow owning children.
By: mirek on Fri, 18 March 2011 23:40
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Sat, 19 March 2011 00:02
|
|
|
Re: Proposed change to U++ to allow owning children.
By: mirek on Sat, 19 March 2011 00:37
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Sat, 19 March 2011 01:30
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Sat, 19 March 2011 01:35
|
|
|
Re: Proposed change to U++ to allow owning children.
By: mirek on Sat, 19 March 2011 10:59
|
|
|
Re: Proposed change to U++ to allow owning children.
By: kohait00 on Sun, 20 March 2011 10:32
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Sun, 20 March 2011 14:07
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Sun, 20 March 2011 14:11
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Sun, 20 March 2011 14:28
|
|
|
Re: Proposed change to U++ to allow owning children.
By: kohait00 on Fri, 25 March 2011 13:26
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Sun, 27 March 2011 15:33
|
|
|
Re: Proposed change to U++ to allow owning children.
By: kohait00 on Sun, 17 April 2011 17:25
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Tue, 19 April 2011 06:00
|
|
|
Re: Proposed change to U++ to allow owning children.
By: kohait00 on Tue, 19 April 2011 09:14
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Tue, 19 April 2011 14:09
|
|
|
Re: Proposed change to U++ to allow owning children.
By: kohait00 on Tue, 19 April 2011 18:05
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 20 April 2011 02:44
|
|
|
Re: Proposed change to U++ to allow owning children.
By: kohait00 on Wed, 20 April 2011 08:51
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 20 April 2011 19:24
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 20 April 2011 21:17
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 20 April 2011 21:23
|
|
|
Re: Proposed change to U++ to allow owning children.
By: Lance on Wed, 20 April 2011 21:38
|
|
|
Re: Proposed change to U++ to allow owning children.
By: kohait00 on Thu, 28 April 2011 16:32
|
|
|
revised ownership change
By: kohait00 on Thu, 28 April 2011 18:28
|
|
|
Re: revised ownership change
By: Lance on Thu, 28 April 2011 21:45
|
|
|
Re: revised ownership change
By: kohait00 on Thu, 28 April 2011 21:57
|
|
|
Re: revised ownership change
By: Lance on Thu, 28 April 2011 23:18
|
|
|
Re: revised ownership change
By: Lance on Thu, 28 April 2011 23:31
|
|
|
Re: revised ownership change
By: Lance on Thu, 28 April 2011 23:54
|
|
|
Re: revised ownership change
|
|
|
Re: revised ownership change
|
|
|
Re: revised ownership change
|
|
|
Re: revised ownership change
By: Lance on Mon, 06 June 2011 05:11
|
|
|
Re: revised ownership change
By: Lance on Mon, 06 June 2011 05:05
|
Goto Forum:
Current Time: Tue May 14 04:10:13 CEST 2024
Total time taken to generate the page: 0.02877 seconds
|
|
|