John Levon <[EMAIL PROTECTED]> writes:

| Doing lyx -x lyx-quit big.lyx,  the attached patch
| gives the following results (warm cache, error around 4%) :
| 
| user (s)        | sys (s)       | elapsed (s)           |
| ----------------------------------------------------------------------
| 28.33 (0.00%)   | 0.30 (0.00%)  | 29.61 (0.00%)         | newinsetsold
| 24.29 (-14.27%) | 0.32 (6.61%)  | 25.92 (-12.48%)       | newinsetsnew
| 
| and the binary is only 14k bigger (with -g -O). This seems worth it to me.

I don't want this patch yet.

If you have lines like:

        do_something(with_this.size());

and widh_this.size() is inlined and do_something segfaults, the
segfault can look like it happened inside with_this.size(). 

Also when having inlines in the header file, alway put the inlined
method after the class definithin with an inline, in the class inline
should not be used:

class Foo {
publi:
        int size();
};

inline
Foo::size() {
        return ...;
}


As you can see with this it is _very_ easy to move the inlined method
from the header file to the C file (and back).

I have been thinking of a scheme where we can choose at compile time
if we want to have methods like this inlined or not.

foo.h:
class Foo {
public:
        int size();
};

#ifdef INLINE_SIMPLE_METHODS
#define INLINE inline
#include "foo_inlines.h"
#endif

foo_inlines.h:
INLINE
Foo::size() {
        return ...;
}

foo.C:
#ifndef INLINE_SIMPLE_METHODS
#define INLINE
#include "foo_inlines.h"
#endif


Or another scheme that gives the same effect.

        Lgb

Reply via email to