[rfc] Flyweight library

Hi all, After a year since the last published draft, I think the flyweight library I'm working on is in a sufficiently polished state to issue a request for comments on its usefulness and eventual suitability for inclusion into the Boost review queue. * Abstract: Flyweights are small-sized handle classes granting constant access to shared common data, thus allowing for the management of large amounts of entities within reasonable memory limits. Boost.Flyweight makes it easy to use this common programming idiom by providing the class template flyweight<T>, which acts as a drop-in replacement for const T. * Design: The flyweight library is a relatively small piece of software that tries to combine both maximum simplicity of usage for casual users and great flexibility for those programmers needing to control aspects of the implementation. Configuration and customization rely upon a very extensive policy interface, whose syntax is kept under control thanks to the Boost Parameter Library. The following aspects can be controlled: - Specification and parameterization of the so-called flyweight factory. - Control of the factory instantiation procedure. - Specification of the internal synchronization mechanisms. - Flyweight tracking, allowing for the disposal of stored values when no longer referenced by any flyweight object. The library provides a catalog of plug-in components, but the user can also supply her own as the needed concepts are publicly documented. In particular, an insidious problem with duplication of flyweight factories across dynamic modules is taken care of by a component called intermodule_holder, whose implementation is based on Boost.Interprocess. * Download: Boost Vault, folder Patterns (http://tinyurl.com/hrdm6 ), file flyweight.zip. * Online docs: http://tinyurl.com/2jbucf . * Usage: Will only work with the trunk version of Boost, daily snapshot at http://boost-consulting.com/boost.tar.bz2 . Currently, serialization capabilities are not working, pending the resolution of the issue exposed at http://lists.boost.org/Archives/boost/2007/09/127065.php . * Tested on: GCC 3.4.4 on mingw, MSVC++ 8.0. Comments, suggestions, cricitisms, are most welcome. I would also like to know if there's interest in having this included in the review queue. Thank you, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

JOAQUIN LOPEZ MU?Z wrote:
Hi all,
After a year since the last published draft, I think the flyweight library I'm working on is in a sufficiently polished state to issue a request for comments on its usefulness and eventual suitability for inclusion into the Boost review queue.
Cool stuff -- I'd like to see this go forward :-) Jeff

JOAQUIN LOPEZ MU?Z wrote:
Hi all,
After a year since the last published draft, I think the flyweight library I'm working on is in a sufficiently polished state to issue a request for comments on its usefulness and eventual suitability for inclusion into the Boost review queue.
Definitely interested. Sebastian Redl

JOAQUIN LOPEZ MU?Z escribió:
Hi all,
After a year since the last published draft, I think the flyweight library I'm working on is in a sufficiently polished state to issue a request for comments on its usefulness and eventual suitability for inclusion into the Boost review queue.
Very nice and configurable. Definitely interested. Regards, Ion

On 11/12/07, "JOAQUIN LOPEZ MU?Z" <joaquin@tid.es> wrote:
Hi all,
Hi :)
After a year since the last published draft, I think the flyweight library I'm working on is in a sufficiently polished state to issue a request for comments on its usefulness and eventual suitability for inclusion into the Boost review queue.
I have stated it one year ago. I would like to see this lib in Boost. Thanks for the work Joaquin! Best regards Mat

Amazing, I didn't know about the flyweight pattern and coded this myself but I called it hash_pool. And of course it wasn't as sophisticated as what you are presenting. It had a refcount tracking and was only 300 lines of code though :-) Now, I feel like I don't have to write code anymore, Boost will just come up with something better. Anyway I will do some tests to see how it compares in terms of performance, but it looks very good. Thanks Joaquin! Kevin

Kevin Sopp ha escrito:
Amazing, I didn't know about the flyweight pattern and coded this myself but I called it hash_pool. And of course it wasn't as sophisticated as what you are presenting. It had a refcount tracking and was only 300 lines of code though :-) Now, I feel like I don't have to write code anymore, Boost will just come up with something better.
This is not a Boost library :) though I intend it to be.
Anyway I will do some tests to see how it compares in terms of performance, but it looks very good.
Please report back, I'm very interested in knowing how the stuff performs in a real life scenario. Thanks! Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

Matias Capeletto wrote:
On 11/12/07, "JOAQUIN LOPEZ MU?Z" <joaquin@tid.es> wrote:
Hi all,
Hi :)
After a year since the last published draft, I think the flyweight library I'm working on is in a sufficiently polished state to issue a request for comments on its usefulness and eventual suitability for inclusion into the Boost review queue.
I have stated it one year ago. I would like to see this lib in Boost. Thanks for the work Joaquin!
Same here! :-) Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net

On Nov 13, 2007 2:43 PM, Joel de Guzman <joel@boost-consulting.com> wrote:
Matias Capeletto wrote:
On 11/12/07, "JOAQUIN LOPEZ MU?Z" <joaquin@tid.es> wrote:
Hi all,
Hi :)
After a year since the last published draft, I think the flyweight library I'm working on is in a sufficiently polished state to issue a request for comments on its usefulness and eventual suitability for inclusion into the Boost review queue.
I have stated it one year ago. I would like to see this lib in Boost. Thanks for the work Joaquin!
Same here! :-)
This is so important, we need it yesterday! :D I definitely would like to see this in Boost soon. :) Thanks for the work! -- Dean Michael C. Berris Software Engineer, Friendster, Inc. [http://cplusplus-soup.blogspot.com/] [mikhailberis@gmail.com] [+63 928 7291459] [+1 408 4049523]

"JOAQUIN LOPEZ MU?Z" ha escrito:
Hi all,
After a year since the last published draft, I think the flyweight library I'm working on is in a sufficiently polished state to issue a request for comments on its usefulness and eventual suitability for inclusion into the Boost review queue.
Thanks Jeff, Joseph, Sebastian, Ion, Matías, Kevin, Joel, Dean Michael and John for your warm expressions of interest! Given the favorable reception of the lib, I've just submitted a formal review request. Judging from the review backlog size we're a good many weeks from a review, so in the meantime I'd really appreciate your suggestions for improvement, reports of usage etc. In particular, there's an issue that I think will attract some discussion: The flyweight factory is instantiated by means of a so-called *holder*, which is similar to a singleton, and as such has the usual complications regarding thread-safe static initialization. The solution adopted by the current version of the lib guarantees that the holder (and its associated factory) is constructed at dynamic initialization time (std 3.6.2). Theoretically such initialization can be deferred to the first usage of the object, though in current practice by all compilers this is done before entering main(), which renders the procedure thread safe unless threads are spawned before main. I'd like to know whether this is judged satisfactory or if, on the contrary, more control on the process is needed. Best regards, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
participants (11)
-
"JOAQUIN LOPEZ MU?Z"
-
Dean Michael Berris
-
Ion Gaztañaga
-
Jeff Garland
-
Joaquín Mª López Muñoz
-
Joel de Guzman
-
John Reid
-
Joseph Wu
-
Kevin Sopp
-
Matias Capeletto
-
Sebastian Redl