Re: Comparing Named Functor, bind and lambda

2004-01-07 Thread Lars Gullik Bjønnes
[EMAIL PROTECTED] (Lars Gullik Bjønnes) writes: | | IMO there is a draw between 'old fashioned code' and lambda. If one | | needs to decide for one or the other, other criteria are needed. | | 'simple standard constructs' would be one of them. > | so bind(&Foo::name, _1, name) This was not the ex

Re: Comparing Named Functor, bind and lambda

2004-01-07 Thread Lars Gullik Bjønnes
Andre Poenitz <[EMAIL PROTECTED]> writes: >> | IMO there is a draw between 'old fashioned code' and lambda and the tie >> | breaker 'simple standard constructs' prefers 'old fashioned code'. >> >> can you add some commas to make me understand the sentence? > | IMO there is a draw between 'old fas

Re: Comparing Named Functor, bind and lambda

2004-01-07 Thread Andre Poenitz
On Tue, Jan 06, 2004 at 07:44:47PM +0100, Lars Gullik Bjønnes wrote: > struct SameName : public std::unary_function { >SameName(std::string const & name) : name_(name) {} >bool operator()(Foo const & foo) const { return foo.name() == name_; } >std::string name_; > }; > > a

Re: Comparing Named Functor, bind and lambda

2004-01-06 Thread Alfredo Braunstein
Lars Gullik BjÃnnes wrote: > I thought it as a nice start as it made me allocate some time, rather > than none, on lyx code. Cheers for that. Alfredo

Re: Comparing Named Functor, bind and lambda

2004-01-06 Thread Lars Gullik Bjønnes
Andre Poenitz <[EMAIL PROTECTED]> writes: | On Tue, Jan 06, 2004 at 07:14:48PM +0100, Lars Gullik Bjønnes wrote: >> Andre Poenitz <[EMAIL PROTECTED]> writes: >> >> | case 1 seems to be uniformly better. So why not use it? >> >> because it is some ~10 lines longer. > | I see about 5 which goes do

Re: Comparing Named Functor, bind and lambda

2004-01-06 Thread Andre Poenitz
On Tue, Jan 06, 2004 at 07:14:48PM +0100, Lars Gullik Bjønnes wrote: > Andre Poenitz <[EMAIL PROTECTED]> writes: > > | case 1 seems to be uniformly better. So why not use it? > > because it is some ~10 lines longer. I see about 5 which goes down to 4 for the unnecessary 'public' when changing th

Re: Comparing Named Functor, bind and lambda

2004-01-06 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | Here I get run-time ratios (for 1000 loops) of > | boost::bind / Named Functor == 1.89 | boost::function / Named Functor == 1.89 | boost::lambda / Named Functor == 2.45 > | Draw your own conclusions. Gcc 3.4 is better than gcc 3.3. -- Lgb

Re: Comparing Named Functor, bind and lambda

2004-01-06 Thread Angus Leeming
Angus Leeming wrote: > For completeness, here is the same code with an additional > boost::function test: > > $ size bind_lambda? > dec hex filename > 8799225f bind_lambda1 // Named Functor > 10508290c bind_lambda2 // boost::bind > 158943e16 bind_lambda3 // boost::function > 105

Re: Comparing Named Functor, bind and lambda

2004-01-06 Thread Lars Gullik Bjønnes
Andre Poenitz <[EMAIL PROTECTED]> writes: | case 1 seems to be uniformly better. So why not use it? because it is some ~10 lines longer. And if the functor is only being used once... (the tables are turned if the functor is used in several places) Also it is not unlikely that case 2 and 3 will c

Re: Comparing Named Functor, bind and lambda

2004-01-06 Thread Lars Gullik Bjønnes
John Levon <[EMAIL PROTECTED]> writes: | On Tue, Jan 06, 2004 at 06:44:21PM +0100, Andre Poenitz wrote: > >> case 1 seems to be uniformly better. So why not use it? > | It's a bit long winded, that's why. But since we have serious bloat | problems already ... And the best way to combat bloat is t

Re: Comparing Named Functor, bind and lambda

2004-01-06 Thread Angus Leeming
Lars Gullik Bjønnes wrote: > Angus Leeming <[EMAIL PROTECTED]> writes: > > | $ size trial_case? > |textdata bss dec hex filename > |7850 816 8867421e2 trial_case1 > |9510 840 16 10366287e trial_case2 > |9530 872 8 10410

Re: Comparing Named Functor, bind and lambda

2004-01-06 Thread John Levon
On Tue, Jan 06, 2004 at 06:44:21PM +0100, Andre Poenitz wrote: > case 1 seems to be uniformly better. So why not use it? It's a bit long winded, that's why. But since we have serious bloat problems already ... john -- Khendon's Law: If the same point is made twice by the same person, the thread

Re: Comparing Named Functor, bind and lambda

2004-01-06 Thread Andre Poenitz
On Tue, Jan 06, 2004 at 06:40:06PM +0100, Lars Gullik Bjønnes wrote: > Angus Leeming <[EMAIL PROTECTED]> writes: > > | $ size trial_case? > |textdata bss dec hex filename > |7850 816 8867421e2 trial_case1 > |9510 840 16 10366287e trial_c

Re: Comparing Named Functor, bind and lambda

2004-01-06 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | $ size trial_case? |textdata bss dec hex filename |7850 816 8867421e2 trial_case1 |9510 840 16 10366287e trial_case2 |9530 872 8 1041028aa trial_case3 With gcc 3.4: size t

Re: Comparing Named Functor, bind and lambda

2004-01-06 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | Lars Gullik Bjønnes wrote: | Whould have been nice if you could actually send the trial.C file. >> >> Hard to duplicate the test here without it... > | ??? | It's attached to the original mail. See either of I am stupid ignore me. -- Lgb

Re: Comparing Named Functor, bind and lambda

2004-01-06 Thread Angus Leeming
Lars Gullik Bjønnes wrote: Whould have been nice if you could actually send the trial.C file. > > Hard to duplicate the test here without it... ??? It's attached to the original mail. See either of http://articles.gmane.org/gmane.editors.lyx.devel:32848 http://marc.theaimsgroup.com/?l=lyx-devel&

Re: Comparing Named Functor, bind and lambda

2004-01-06 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | Attached is a sample code that implements the three approaches that Lars has | been playing with. > | std::string const search_name = "william"; > | FooVec::const_iterator const begin = foovec.begin(); | FooVec::const_iterator const en

Re: Comparing Named Functor, bind and lambda

2004-01-06 Thread Andre Poenitz
On Tue, Jan 06, 2004 at 04:02:51PM +, Angus Leeming wrote: > I have little idea how to make sense of the assembler code but, at least for > gcc 3.3, it appears that the named functor approach produces the > smallest-sized executable. > > $ size trial_case? >textdata bss dec

Comparing Named Functor, bind and lambda

2004-01-06 Thread Angus Leeming
Attached is a sample code that implements the three approaches that Lars has been playing with. std::string const search_name = "william"; FooVec::const_iterator const begin = foovec.begin(); FooVec::const_iterator const end = foovec.end(); FooVec::const_iterator