From IT Skills
Jump to: navigation, search

web.config[edit | edit source]

Development performance optimization[edit | edit source]

Set batch to false[edit | edit source]

When an ASP.NET website is loaded for the first time, it pre-compiles all pages and user controls. Once done, everything runs faster. This is great for production websites, but horrible for development machine. Why? When programming, you’re usually only modifying a page or two (or back-end code). You’ll iteratively make a change, compile, launch the website, test, and start over; often dozens of times. A two minute compile/load time (like we had) forces you to lose focus and get distracted. This setting makes pre-compilation more selective, making the first load time massively faster in development scenarios.
<compilation ...  batch="false">

Set optimizeCompilations to true. It prevents full recompilation that in many cases (not all) is a good choise for development purposes[edit | edit source]

<compilation ...  optimizeCompilations="true">

Store temporary IIS files on your fastest disk or a RAM disk[edit | edit source]

  1. Go http://memory.dataram.com/products-and-services/software/ramdisk
  2. Download and install RAMDisk Software ("freeware" for personal use).
  3. Configure RAMDisk. I've set following parameters:
    1. on start - Create a new FAT disk
    2. using - 512Mb
    3. label disk as RAMDisk
    4. do not create a TEMP directory
    5. on changes to the disk - do not save them
  4. Start RAMDisk.
  5. In web.config set:
<compilation ...  tempDirectory="[RAMDisk drive letter]:\IISTEMP\">

Coding rules[edit | edit source]

DateTime exchange[edit | edit source]

JS

$.ajax({
    type: "POST",
    contentType: 'application/json',
    dataType: 'json',
    data: JSON.stringify({date: fixDateForPostingToServer(someDateVariable)}), ...

Server-side

[System.Web.Mvc.HttpPost]
public ActionResult SomeAction(DateTime date)

Magic delimiter[edit | edit source]

JS

var delim = unescape('%BF');

Server-side

PDTCommon.STR_DELIM

This category currently contains no pages or media.