Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
enumerator callback question
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Paul Nema  
View profile  
 More options Jan 16, 9:43 pm
From: Paul Nema <pauln...@gmail.com>
Date: Mon, 16 Jan 2012 21:43:56 -0500
Local: Mon, Jan 16 2012 9:43 pm
Subject: enumerator callback question

Updating classes, like classstring.cpp, classarray.cpp, etc.

For function: void ClassString::enumerateProperties( void*,
Class::PropertyEnumerator& cb ) const

PropertyEnumerator operator cb is called for each class method.

Class String has 26 methods, so 26 cb calls (I.E. cb( "methodName", false
); etc+25 ) each time this class is instantiated.
Could be expensive when creating a lot of arrays.

There are more efficient way to perform this.
Examples:
1. A comma delimited string of methods

2. Pass an array of methods

3. Something else? etc.

Probably a reason for the current design as opposed to the above
suggestions.  If so please elaborate.  If not let me know and I explore how
to update enumerator.h

Thanks


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "{FalconPL} enumerator callback question" by Giancarlo Niccolai
Giancarlo Niccolai  
View profile  
 More options Jan 17, 4:17 am
From: Giancarlo Niccolai <g...@niccolai.cc>
Date: Tue, 17 Jan 2012 10:17:14 +0100
Local: Tues, Jan 17 2012 4:17 am
Subject: Re: {FalconPL} enumerator callback question
On 17/01/2012 03:43, Paul Nema wrote:

> Updating classes, like classstring.cpp, classarray.cpp, etc.

> For function: void ClassString::enumerateProperties( void*,
> Class::PropertyEnumerator& cb ) const

> PropertyEnumerator operator cb is called for each class method.

> Class String has 26 methods, so 26 cb calls (I.E. cb( "methodName",
> false ); etc+25 ) each time this class is instantiated.
> Could be expensive when creating a lot of arrays.

> There are more efficient way to perform this.
> Examples:
> 1. A comma delimited string of methods

Btw, what makes you think that a n-times call to the enumerator callback
is less efficient than
1) Allocating a dynamic string
2) concatenate strings n times into that (which often means reallocating
the string)
3) call the callback once
4) have the callback calling n times findnext(',')
5) creating n times a substring from , to , (with the extra checks for
the last string, and possibly dynamic allocation for each substring if
the string algos are not VERY smart)
6) destroying the string

Also, consider having to call n times next() on the iterator of a map.
Unless it's inlined, you're not gaining much on the callback approach
(also, jumping on the map leaves causes loss of memory locality).

Gian.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »