Posts

Showing posts with the label Collection

JSONH New schema Argument

The freaking fast and bandwidth saver JSONH Project has finally a new schema argument added at the end of every method in order to make nested Homogeneous Collections automatically " packable ", here an example: var // nested objects b property // have same homogeneous collections // in properties c and d schema = ["b.c", "b.d"], // test case test = [ { // homogeneous collections in c and d b: { c: [ {a: 1}, {a: 2} ], d: [ {a: 3}, {a: 4} ] } }, { a: 1, // same h...

JSONH And Hybrid JS Objects

Image
I have already described JSONH and now I also have the proof that it's as safe as native JSON is but on average 2X faster than native JSON operations with both small (10 objects), medium (100 objects), and massive (5000 objects and not a real world case, just a stress test to see how much JSONH scales) homogenous collections. Wherever it's not faster it's just " as fast " but the best part is that it seems to be always faster on slower machines ( mobile ). Moreover, the 5000 objects stress example shows that JSONH.stringify() produces a string with 54% of original JSON.stringify() size so here the summary: JSONH is faster on both compression and decompression plus it produces smaller output yeah but ... what About Hybrid Objects To start with, if you don't recognize/understand what is an homogenous collection and ask me: " what about nested objects? ", all I can do is to point you out that Peter Michaux explained this years before me. Have a ...

Last Version Of JSON Hpack

Update created github repository with (currently) JavaScript, PHP5 and Python versions. Update after quick chat on twitter with @devongovett who pointed out there is a similar standard called JSONDB I have created a JSONH(Flat) version . It looks slightly faster on mobile so I may opt for this one rather than Array of keys at index 0. The whole array is flat and it changes from [{a:"A"},{a:"B"}] to [1,"a","A","B"] where the empty collection would be [0] rather than [[]] . Also more details here on how to JSONH Hybrid JS Objects . A while ago I proposed a homogeneous collections optimizer nick named JSON.hpack . What I wasn't expecting is that actually different projects and developers adopted this technique to shrink down JSON size. Basic Advantage Of JSON.hpack Gzip and deflate work really good with repeated chunks of strings and this is why homogeneous collections have really good compression ratio there. However, gzip...

JavaScript Static Collection - A New Type Of Variable

Nowadays, I am working over a crazy manager between an XML with form information, another XML with custom rules to drive the XML with form information (DropDown onchange events, validation, and much more) and both to drive a runtime Ext.form.FormPanel with runtime components manipulated runtime via those two XML and over regular (x)HTML ... a runtime nightmare, but it is not the point. While I was working over an Easy XPath Library for (x)HTML, trying to obtain best performances with the black sheep Internet Explorer, I ended up in an msdn page which explains the attributes HTML Element property. Funny enough, that kind of property has truly a weird behavior, it is between VBScript and JavaScript. There are two ways to access its key/value pairs , the normal and logical one, plus the WTF!!! one. Example: for(var attrs = document.body.attributes, len = attrs.length, i = 0; i < len; ++i ) attrs(i) === attrs[i]; // true The first though was: damn it, som...