Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Not an answer, but to give a rough estimate of "savings" based on 10k entries and some bogus data :-) This is in response to a comment I posted. Will the added complexity make the schema'ized approach worth it?</p> <p>"It depends."</p> <p>This C# is <a href="http://json.org" rel="noreferrer">LINQPad</a> and is ready-to-go for testing/modifying:</p> <pre><code>string LongTemplate (int n1, int n2, int n3, string name) { return string.Format(@" {{ ""codePractice"": {0}, ""codeScheduleObject"": {1}, ""codeScheduleObjectType"": """", ""defaultCodeScheduleObject"": {2}, ""name"": ""Dr. {3}"" }}," + "\n", n1, n2, n3, name); } string ShortTemplate (int n1, int n2, int n3, string name) { return string.Format("[{0}, {1}, \"\", {2}, \"Dr. {3}\"],\n", n1, n2, n3, name); } string MinTemplate (int n1, int n2, int n3, string name) { return string.Format("[{0},{1},\"\",{2},\"Dr. {3}\"],", n1, n2, n3, name); } long GZippedSize (string s) { var ms = new MemoryStream(); using (var gzip = new System.IO.Compression.GZipStream(ms, System.IO.Compression.CompressionMode.Compress, true)) using (var sw = new StreamWriter(gzip)) { sw.Write(s); } return ms.Position; } void Main() { var r = new Random(); var l = new StringBuilder(); var s = new StringBuilder(); var m = new StringBuilder(); for (int i = 0; i &lt; 10000; i++) { var n1 = r.Next(10000); var n2 = r.Next(10000); var n3 = r.Next(10000); var name = "bogus" + r.Next(50); l.Append(LongTemplate(n1, n2, n3, name)); s.Append(ShortTemplate(n1, n2, n3, name)); m.Append(MinTemplate(n1, n2, n3, name)); } var lc = GZippedSize(l.ToString()); var sc = GZippedSize(s.ToString()); var mc = GZippedSize(s.ToString()); Console.WriteLine(string.Format("Long:\tNormal={0}\tGZip={1}\tCompressed={2:P}", l.Length, lc, (float)lc / l.Length)); Console.WriteLine(string.Format("Short:\tNormal={0}\tGZip={1}\tCompressed={2:P}", s.Length, sc, (float)sc / s.Length)); Console.WriteLine(string.Format("Min:\tNormal={0}\tGZip={1}\tCompressed={2:P}", m.Length, mc, (float)mc / m.Length)); Console.WriteLine(string.Format("Short/Long\tRegular={0:P}\tGZip={1:P}", (float)s.Length / l.Length, (float)sc / lc)); Console.WriteLine(string.Format("Min/Long\tRegular={0:P}\tGZip={1:P}", (float)m.Length / l.Length, (float)mc / lc)); } </code></pre> <p>My results:</p> <pre>Long: Normal=1754614 GZip=197053 Compressed=11.23 % Short: Normal=384614 GZip=128252 Compressed=33.35 % Min: Normal=334614 GZip=128252 Compressed=38.33 % Short/Long Regular=21.92 % GZip=65.09 % Min/Long Regular=19.07 % GZip=65.09 %</pre> <p>Conclusion:</p> <ul> <li>The single biggest savings is to use GZIP (better than just using schema'ize).</li> <li>GZIP + schema'ized will be the smallest overall.</li> <li>With GZIP there is <em>no point</em> to use a normal JavaScript minimizer (in this scenario).</li> <li>Use GZIP (e.g. DEFLATE); it performs very well on repetitive structured text (900% compression on normal!).</li> </ul> <p>Happy coding.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload