diff options
author | Rodrigo Kumpera <kumpera@gmail.com> | 2013-03-05 03:34:52 +0400 |
---|---|---|
committer | Rodrigo Kumpera <kumpera@gmail.com> | 2013-03-08 01:09:34 +0400 |
commit | 7b4a395f24c75bb43f021106d15ad2d08439d047 (patch) | |
tree | a335acb48734e9d5ec5f0cea7e99cc901a267da2 /eglib | |
parent | 2082ed2247dfc939314c57b12991ebaa7d5cab7c (diff) |
Make sure all functions in the hot path of eg_utf8_to_utf16_general are inlined.
This gives a 33% performance boost on a micro benchmark just triggering a call
to mono_string_new.
Diffstat (limited to 'eglib')
-rw-r--r-- | eglib/src/giconv.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/eglib/src/giconv.c b/eglib/src/giconv.c index 2f44336aa0b..9fe0edd3324 100644 --- a/eglib/src/giconv.c +++ b/eglib/src/giconv.c @@ -34,6 +34,13 @@ #endif #include <errno.h> +#ifdef _MSC_VER +#define FORCE_INLINE(RET_TYPE) __forceinline RET_TYPE +#else +#define FORCE_INLINE(RET_TYPE) inline RET_TYPE __attribute__((always_inline)) +#endif + + #define UNROLL_DECODE_UTF8 0 #define UNROLL_ENCODE_UTF8 0 @@ -61,7 +68,7 @@ static int encode_utf16be (gunichar c, char *outbuf, size_t outleft); static int decode_utf16le (char *inbuf, size_t inleft, gunichar *outchar); static int encode_utf16le (gunichar c, char *outbuf, size_t outleft); -static int decode_utf8 (char *inbuf, size_t inleft, gunichar *outchar); +static FORCE_INLINE (int) decode_utf8 (char *inbuf, size_t inleft, gunichar *outchar); static int encode_utf8 (gunichar c, char *outbuf, size_t outleft); static int decode_latin1 (char *inbuf, size_t inleft, gunichar *outchar); @@ -480,7 +487,7 @@ encode_utf16le (gunichar c, char *outbuf, size_t outleft) } } -static int +static FORCE_INLINE (int) decode_utf8 (char *inbuf, size_t inleft, gunichar *outchar) { unsigned char *inptr = (unsigned char *) inbuf; @@ -828,7 +835,7 @@ g_unichar_to_utf8 (gunichar c, gchar *outbuf) return n; } -static int +static FORCE_INLINE (int) g_unichar_to_utf16 (gunichar c, gunichar2 *outbuf) { gunichar c2; |