============================================ Binding Performance and style caching - PD ============================================ Scryber does a number of activities underneath to improve performance and reuse cached data where possible. Downloaded font-files are kept locally Images can be cached and re-used, and only one reference is used in the files. It also caches the full stype of individual elements. Including those in templates. Appending the log file can also give great insight into the If for example there is a need to output a 10,000 row listing to PDF then we can create a template to do that and inject the Model. .. code-block:: html Large File Test Document

Binding large data

This is a test of binding the content to a table.

Name Value
.. code-block:: csharp public void LargeFileTest() { var path = System.Environment.CurrentDirectory; path = System.IO.Path.Combine(path, "../../../Content/HTML/LargeFile.html"); data = new { Items = GetListItems(10000) }; using (var doc = Document.ParseDocument(path)) { doc.Params["model"] = data; using (var stream = DocStreams.GetOutputStream("LargeFile.pdf")) { doc.SaveAsPDF(stream); } } } private class ListItem { public string Key { get; set; } public int Value { get; set; } public string Row { get; set; } } private static ListItem[] GetListItems(int count) { var mocks = new ListItem[count]; for (int i = 0; i < count; i++) { ListItem m = new ListItem() { Key = "Item " + i.ToString(), Value = i, Row = (i % 2 == 1) ? "odd" : "even" }; mocks[i] = m; } return mocks; } And the output from this will be 157 pages of lovely tables of content. .. image:: images/documentStyleCaching.png As can be seen with the scryber processing instruction in the template, we are appending the trace log tables to this file. .. image:: images/documentStyleCachingTrace.png The contents of this show the breakdown of time including the template parsing - 680ms for 10,314 items (table rows, page header and footers).