Re: [RFC PATCH] qobject: Rewrite implementation of QDict for in-order traversal

2022-07-18 Thread Markus Armbruster
Peter Maydell writes: > On Mon, 11 Jul 2022 at 12:09, Daniel P. Berrangé wrote: >> >> On Mon, Jul 11, 2022 at 11:32:35AM +0100, Peter Maydell wrote: >> > I'm pretty sure that nothing needs sparse array elements like >> > that. The major reason for the len-PROP field is an implementation >> > one

Re: [RFC PATCH] qobject: Rewrite implementation of QDict for in-order traversal

2022-07-11 Thread Peter Maydell
On Mon, 11 Jul 2022 at 12:09, Daniel P. Berrangé wrote: > > On Mon, Jul 11, 2022 at 11:32:35AM +0100, Peter Maydell wrote: > > I'm pretty sure that nothing needs sparse array elements like > > that. The major reason for the len-PROP field is an implementation > > one: because there is currently no

Re: [RFC PATCH] qobject: Rewrite implementation of QDict for in-order traversal

2022-07-11 Thread Daniel P . Berrangé
On Mon, Jul 11, 2022 at 11:32:35AM +0100, Peter Maydell wrote: > On Fri, 8 Jul 2022 at 12:01, Daniel P. Berrangé wrote: > > What alternative options do we have for addressing this scenario. > > > > I can think of > > > > - Auto-create array elements, if seeing an element set before length. > > >

Re: [RFC PATCH] qobject: Rewrite implementation of QDict for in-order traversal

2022-07-11 Thread Peter Maydell
On Fri, 8 Jul 2022 at 12:01, Daniel P. Berrangé wrote: > What alternative options do we have for addressing this scenario. > > I can think of > > - Auto-create array elements, if seeing an element set before length. > > This is based on the theory that 'len-PROP' field is largely > redun

Re: [RFC PATCH] qobject: Rewrite implementation of QDict for in-order traversal

2022-07-08 Thread Daniel P . Berrangé
On Wed, Jul 06, 2022 at 01:35:22PM +0200, Markus Armbruster wrote: > Markus Armbruster writes: > > > QDict is implemented as a simple hash table of fixed size. Observe: > > > > * Slow for large n. Not sure this matters. > > > > * A QDict with n entries takes 4120 + n * 32 bytes on my box. Wast

Re: [RFC PATCH] qobject: Rewrite implementation of QDict for in-order traversal

2022-07-08 Thread Markus Armbruster
Alex Bennée writes: > Markus Armbruster writes: > >> QDict is implemented as a simple hash table of fixed size. Observe: >> >> * Slow for large n. Not sure this matters. >> >> * A QDict with n entries takes 4120 + n * 32 bytes on my box. Wastes >> space for small n, which is a common case.

Re: [RFC PATCH] qobject: Rewrite implementation of QDict for in-order traversal

2022-07-07 Thread Alex Bennée
Markus Armbruster writes: > QDict is implemented as a simple hash table of fixed size. Observe: > > * Slow for large n. Not sure this matters. > > * A QDict with n entries takes 4120 + n * 32 bytes on my box. Wastes > space for small n, which is a common case. > > * Order of traversal depe

Re: [RFC PATCH] qobject: Rewrite implementation of QDict for in-order traversal

2022-07-07 Thread Daniel P . Berrangé
On Tue, Jul 05, 2022 at 11:54:21AM +0200, Markus Armbruster wrote: > QDict is implemented as a simple hash table of fixed size. Observe: > > * Slow for large n. Not sure this matters. I presume you're referring qdict_find() here, which would ideally be O(1). Our bucket size is 512, so for hash

Re: [RFC PATCH] qobject: Rewrite implementation of QDict for in-order traversal

2022-07-07 Thread Daniel P . Berrangé
On Thu, Jul 07, 2022 at 04:27:35PM +0200, Markus Armbruster wrote: > Peter Maydell writes: > > > On Tue, 5 Jul 2022 at 10:54, Markus Armbruster wrote: > >> > >> QDict is implemented as a simple hash table of fixed size. Observe: > >> > >> * Slow for large n. Not sure this matters. > >> > >> *

Re: [RFC PATCH] qobject: Rewrite implementation of QDict for in-order traversal

2022-07-07 Thread Daniel P . Berrangé
On Tue, Jul 05, 2022 at 11:54:21AM +0200, Markus Armbruster wrote: > QDict is implemented as a simple hash table of fixed size. Observe: > > * Slow for large n. Not sure this matters. > > * A QDict with n entries takes 4120 + n * 32 bytes on my box. Wastes > space for small n, which is a com

Re: [RFC PATCH] qobject: Rewrite implementation of QDict for in-order traversal

2022-07-07 Thread Markus Armbruster
Peter Maydell writes: > On Tue, 5 Jul 2022 at 10:54, Markus Armbruster wrote: >> >> QDict is implemented as a simple hash table of fixed size. Observe: >> >> * Slow for large n. Not sure this matters. >> >> * A QDict with n entries takes 4120 + n * 32 bytes on my box. Wastes >> space for sm

Re: [RFC PATCH] qobject: Rewrite implementation of QDict for in-order traversal

2022-07-07 Thread Peter Maydell
On Tue, 5 Jul 2022 at 10:54, Markus Armbruster wrote: > > QDict is implemented as a simple hash table of fixed size. Observe: > > * Slow for large n. Not sure this matters. > > * A QDict with n entries takes 4120 + n * 32 bytes on my box. Wastes > space for small n, which is a common case. >

Re: [RFC PATCH] qobject: Rewrite implementation of QDict for in-order traversal

2022-07-06 Thread Mark Cave-Ayland
On 06/07/2022 12:35, Markus Armbruster wrote: Markus Armbruster writes: QDict is implemented as a simple hash table of fixed size. Observe: * Slow for large n. Not sure this matters. * A QDict with n entries takes 4120 + n * 32 bytes on my box. Wastes space for small n, which is a com

Re: [RFC PATCH] qobject: Rewrite implementation of QDict for in-order traversal

2022-07-06 Thread Markus Armbruster
Markus Armbruster writes: > QDict is implemented as a simple hash table of fixed size. Observe: > > * Slow for large n. Not sure this matters. > > * A QDict with n entries takes 4120 + n * 32 bytes on my box. Wastes > space for small n, which is a common case. > > * Order of traversal depend

[RFC PATCH] qobject: Rewrite implementation of QDict for in-order traversal

2022-07-05 Thread Markus Armbruster
QDict is implemented as a simple hash table of fixed size. Observe: * Slow for large n. Not sure this matters. * A QDict with n entries takes 4120 + n * 32 bytes on my box. Wastes space for small n, which is a common case. * Order of traversal depends on the hash function and on insertion