- Commit
- 5e90436d9c90d6e8e5612cebb4266eea432168b4
- Parent
- 0f90fc3f7ec06dd032ab28ef0478c415f831862f
- Author
- John MacFarlane <jgm@berkeley.edu>
- Date
Packed cmark_node struct to fit into 128 bytes.
This gives a small performance boost (0.37 to 0.36).
My personal build of CMark ✏️
Packed cmark_node struct to fit into 128 bytes.
This gives a small performance boost (0.37 to 0.36).
1 file changed, 9 insertions, 6 deletions
Status | File Name | N° Changes | Insertions | Deletions |
Modified | src/node.h | 15 | 9 | 6 |
diff --git a/src/node.h b/src/node.h @@ -6,6 +6,7 @@ extern "C" { #endif #include <stdio.h> +#include <stdint.h> #include "cmark.h" #include "buffer.h" @@ -22,12 +23,13 @@ typedef struct { } cmark_list; typedef struct { - bool fenced; - int fence_length; - int fence_offset; - unsigned char fence_char; cmark_chunk info; cmark_chunk literal; + int fence_length; + /* fence_offset must be 0-3, so we can use int8_t */ + int8_t fence_offset; + unsigned char fence_char; + bool fenced; } cmark_code; typedef struct { @@ -41,8 +43,6 @@ typedef struct { } cmark_link; struct cmark_node { - cmark_node_type type; - struct cmark_node *next; struct cmark_node *prev; struct cmark_node *parent; @@ -55,6 +55,9 @@ struct cmark_node { int start_column; int end_line; int end_column; + + cmark_node_type type; + bool open; bool last_line_blank;