path: root/src/utils
diff options
authorJohn Mark Bell <>2009-08-29 23:38:32 +0000
committerJohn Mark Bell <>2009-08-29 23:38:32 +0000
commit4a9d61f75baf66c6c6fed350477d2a48ff3814e6 (patch)
treeadfa70ae44667bccee241e49ce4ac237c42715d5 /src/utils
parent969324103791a79a0c8202958acd5f8bbf993406 (diff)
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/utils')
1 files changed, 4 insertions, 0 deletions
diff --git a/src/utils/utils.h b/src/utils/utils.h
index 1c380f8..26c9a08 100644
--- a/src/utils/utils.h
+++ b/src/utils/utils.h
@@ -30,6 +30,10 @@
#define UNUSED(x) ((x)=(x))
+#ifndef N_ELEMENTS
+#define N_ELEMENTS(x) (sizeof((x)) / sizeof((x)[0]))
css_fixed number_from_lwc_string(lwc_string *string, bool int_only,
size_t *consumed);