diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2009-08-29 23:38:32 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2009-08-29 23:38:32 +0000 |
commit | 4a9d61f75baf66c6c6fed350477d2a48ff3814e6 (patch) | |
tree | adfa70ae44667bccee241e49ce4ac237c42715d5 /src/stylesheet.h | |
parent | 969324103791a79a0c8202958acd5f8bbf993406 (diff) | |
download | libcss-4a9d61f75baf66c6c6fed350477d2a48ff3814e6.tar.gz libcss-4a9d61f75baf66c6c6fed350477d2a48ff3814e6.tar.bz2 |
1) Allocate css_style bytecode in 16 byte chunks
2) Cache unused css_style objects with chunks of size 16, 32, 48, and 64 bytes
The above should reduce heap churn somewhat.
Further improvements are possible:
1) Make the property parsers write the parsed values direct into the output
bytecode, instead of into a temporary object which is then merged into
the output.
2) Perform similar caching for css_rule and selector objects.
3) Shrink-wrap finalised output styles rather than leaving them oversized.
4) Perform measurement to determine the optimal chunk sizes (power-of-2 makes
maths simple and 16 is plucked from thin air) and cache bucket count/sizes.
svn path=/trunk/libcss/; revision=9502
Diffstat (limited to 'src/stylesheet.h')
-rw-r--r-- | src/stylesheet.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/stylesheet.h b/src/stylesheet.h index 1769bff..df095d9 100644 --- a/src/stylesheet.h +++ b/src/stylesheet.h @@ -24,7 +24,6 @@ typedef struct css_rule css_rule; typedef struct css_selector css_selector; -/** \todo would a parserutils_buffer be better here? */ typedef struct css_style { uint32_t length; /**< Length, in bytes, of bytecode */ void *bytecode; /**< Pointer to bytecode */ @@ -177,6 +176,8 @@ struct css_stylesheet { size_t size; /**< Size, in bytes */ + css_style *free_styles[4]; /**< Free styles: 16B buckets */ + css_url_resolution_fn resolve; /**< URL resolution function */ void *resolve_pw; /**< Private word */ |