├── .gitignore ├── LICENSE ├── LICENSE.html ├── Makefile ├── README.html ├── README.md ├── etc ├── README.html ├── README.md ├── css │ └── style.css ├── images │ ├── fleece-footer-1.1.png │ ├── fleece-footer-1.2.png │ ├── fleece-footer.png │ ├── fleece-head-1.2.2-background.jpg │ ├── fleece-head-1.2.2-letters.png │ └── fleece-head-1.2.2.2-letters.png ├── json4 │ └── json.lua ├── luajson │ ├── Makefile │ ├── luajson.c │ ├── luajson.lua │ ├── readme.txt │ └── test.lua ├── lunit │ ├── ANNOUNCE │ ├── CHANGES │ ├── DOCUMENTATION │ ├── LICENSE │ ├── PATCHES │ ├── README │ ├── example.lua │ ├── lunit │ ├── lunit-console.lua │ ├── lunit-tests.lua │ └── lunit.lua └── markdown.lua ├── hello.lua ├── include ├── README.md ├── ldebug.h ├── ldo.h ├── lgc.h ├── llimits.h ├── lmem.h ├── lobject.h ├── lstate.h ├── ltable.h ├── ltm.h ├── lua.h └── lzio.h ├── index.html ├── src ├── Makefile ├── README.html ├── README.md ├── fleece-buffers.c ├── fleece-buffers.h ├── fleece-config.h ├── fleece-copy.c ├── fleece-ctrl.c ├── fleece-ctrl.h ├── fleece-intern.h ├── fleece-lua.c ├── fleece-numbers.c ├── fleece-size.c ├── fleece-stringify.c ├── fleece.c └── fleece.h └── test ├── README.html ├── README.md ├── SAMPLE.html ├── SAMPLE.md ├── bench-fleece-10k.lua ├── bench-fleece.lua ├── bench-json4.lua ├── bench-luajson.lua ├── bench-yajl.lua ├── bench.lua ├── bench2-1k.lua ├── bench2.lua ├── bench3-1k.lua ├── bench3.lua ├── bench3a.lua ├── bench3b.lua ├── bench4.lua ├── bench4d.lua ├── bench4e.lua ├── bench5.lua ├── bench5a.lua ├── bench5b.lua ├── bench5c.lua ├── bench6a.lua ├── bench7-1k.lua ├── bench7.lua ├── bench74.lua ├── bench7a.lua ├── bench7c.lua ├── test-fleece-5m.lua ├── test-fleece-hello.lua ├── test-fleece-json.lua ├── test-fleece-nonstop.lua ├── test-fleece-rand.lua ├── test-fleece-size.lua ├── test-json4.lua ├── test-luajson.lua └── unit ├── basic.lua ├── complex.lua ├── escapes.lua ├── parameters.lua └── test.lua /.gitignore: -------------------------------------------------------------------------------- 1 | # Eonblast Fleece 0.2.2 2 | 3 | *.a 4 | *.o 5 | *.m 6 | *.so 7 | 8 | lua 9 | luac 10 | lua-yajl 11 | luajson 12 | fleece 13 | 14 | .DS_Store 15 | ._* 16 | *.bak 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | ## License 2 | 3 | **Copyright (c) 2011 Eonblast Corporation** 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the "Software"), to evaluate the Software or use it 8 | in education, science, not-for-profit work, personal, or Open 9 | Source projects including without limitation the rights to copy, 10 | modify, merge, publish, distribute, but not sublicense, and not 11 | sell copies of the Software, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | ________________________________________________________________ 26 | LICENSE fleece - hd Feb 2011 - powered by Eonblast Corporation 27 | -------------------------------------------------------------------------------- /LICENSE.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |Copyright (c) 2011 Eonblast Corporation
93 | 94 |Permission is hereby granted, free of charge, to any person 95 | obtaining a copy of this software and associated documentation 96 | files (the "Software"), to evaluate the Software or use it 97 | in education, science, not-for-profit work, personal, or Open 98 | Source projects including without limitation the rights to copy, 99 | modify, merge, publish, distribute, but not sublicense, and not 100 | sell copies of the Software, subject to the following conditions:
101 | 102 |The above copyright notice and this permission notice shall be 103 | included in all copies or substantial portions of the Software.
104 | 105 |THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 106 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 107 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 108 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 109 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 110 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 111 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 112 | OTHER DEALINGS IN THE SOFTWARE.
113 | 114 |LICENSE fleece - hd Feb 2011 - powered by Eonblast Corporation
116 | 117 |Eonblast Fleece 0.3.1
91 | 92 |LuaJSON and JSON4 are not part of Fleece but included here for comparison. They 102 | are governed by their respective licences.
103 | 104 |See test/README.md
111 | 112 |README fleece/etc hd Feb 2011 - powered by Eonblast http://www.eonblast.com
114 | 115 |Fast Lua to JSON conversion.
16 | 17 |
25 |
26 | More 27 | Tests 28 | Source 29 | Misc 30 | Sample 31 | 32 | Online Home 33 | License 34 | Repository 35 | Eonblast 36 | 37 | 38 | |
39 |
40 |
41 | Download 42 | 43 |git clone https://Eonblast@github.com/Eonblast/fleece-lite.git fleece44 | 45 | Build 46 | 47 |cd fleece 48 | make linux # or make macosx, or make macosx-old for <= 10.3 49 |50 | 51 | Testing 52 | 53 |make test 54 | make bench55 | 56 | Sample 57 | 58 |t = {1,2,3}; 59 | json_str = fleece.json(t)60 | 61 | |
62 |
Eonblast Fleece 0.3.1
91 | 92 |fleece-config.h compile-time configurations
97 |
98 | fleece.c main module file, includes the other c files
99 | fleece.h main header file, not relevant
100 |
101 | fleece-lua.c lua-facing Fleece functions (hello & json so far)
102 |
103 |
104 |
105 | fleece-intern.h internal header file
108 |
109 | fleece-buffers.c custom string buffer source
110 | fleece-buffers.h
111 |
112 | fleece-insp_ctrl.c traversal control structure
113 | fleece-insp_ctrl.h
114 |
115 | fleece-numbers.c number to ascii conversions
116 | fleece-size.c JSON size pre-calculation
117 | fleece-stringify.c Lua data traversal and JSON string production
118 | fleece-copy.c JSON-optimized copying sources
119 |
120 |
121 |
122 | Makefile sub make file, used by the Makefile in Fleece root
125 |
126 | README.md this file
127 | README.html same as README.md in HTML format
128 |
129 | fleece.o Fleece C compilation file, present after build
130 | fleece.so Fleece C library, present after build
131 |
132 |
133 | Lua headers are included from ../include/
134 | 135 |For tests see the ../test/ folder.
136 | 137 |If you use escaping, assembler can make a difference. Fleece does well for non-escaped strings with or without assembler. But consider guarding your string contents against special characters yourself in any case, and do any necessary escaping yourself. In most cases this will prevent much double checking. The setting E0 then ignores escaping issues entirely and is the fastest option for JSON conversion. It allows for strings being copied as they are, without looking at the individual characters.
140 | 141 |Assembler helps most with strings that are to get their control characters escaped, as prescribed by the JSON standard. Assembler is implemented only for x86, using gcc inline/AT&T format. Switch assembler on by using linux-asm, linux-64-asm, or macosx-asm. The options E1 - E4 are the most affected.
144 | 145 |The non-assembler parts are sufficiently fast and optimized for their task. Depending on architecture, they are only around 10 to 50% slower than assembler, mostly due to highly optimized C library memcpy functions.
146 | 147 |Obviously, when escaping characters, the built-in memcpy can not be used alone but string traversing has to take place. strcspn() turned out to be no help performance-wise.
148 | 149 |There are multiple strategies visible in the fleece-copy.c source, some will be abandoned and cleaned up. Basically:
152 | 153 |A) count first, check remaining buffer, enlarge if nec., then copy
155 | B) check if remaining buffer < 'max escape case' (6x), enlarge, copy
156 | C) without any checks rely on assured reserve buffer for single chars
I) plain count, for finding the destination size, then copy
160 | II) count and copy, cancel copying when exceeding assured reserve
161 | III) use built in C lib strcspn to count escape characters (--)
i) memory-copy using given source length
165 | ii) string-copy relying on final 0 (faster for ASM, not tru to Lua)
1) use built in C lib memcpy
169 | 2) use native C programmed memcpy (faster for old PPC) (--)
170 | 3) use native C programmed, block pointer casting-memcpy
171 | 4) use assembler (x86 only, 10 - 20% faster, more on older CPUs)
README fleece/src hd Feb 2011 - powered by Eonblast http://www.eonblast.com
175 | 176 |