25.11.2014 Views

Conference Notes and Best Practices Release 1.3 ... - Read the Docs

Conference Notes and Best Practices Release 1.3 ... - Read the Docs

Conference Notes and Best Practices Release 1.3 ... - Read the Docs

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Conference</strong> <strong>Notes</strong> <strong>and</strong> <strong>Best</strong> <strong>Practices</strong>, <strong>Release</strong> <strong>1.3</strong><br />

• Compress images/Cache<br />

• Image sprites/logos/icons<br />

Resource Order<br />

• Load first styles in critical path<br />

• Place JS after o<strong>the</strong>r resources, ideally at <strong>the</strong> end of <strong>the</strong> file.<br />

• Inline some CSS at <strong>the</strong> top.<br />

• Lazy loading (Load images/assets only if <strong>the</strong> user gets <strong>the</strong>re)<br />

Assets CDNS<br />

• Geographically serve assets<br />

• Improve load time<br />

Improve Backend<br />

• SQL Queries<br />

• Use “values_list”<br />

• Verify same queries aren’t running multiple times<br />

• Select_related <strong>and</strong> prefetch_related<br />

Select Related <strong>and</strong> Prefetch Related<br />

• Get foreign keys<br />

• If getting foreign keys use select_related<br />

• Prefetch related can work for many to many queries<br />

Cache<br />

• How should I cache?<br />

• Memcache<br />

• Use low level cache?<br />

Low Level<br />

• Flexibility<br />

• Reduce lookups<br />

• get() set() delete() methods<br />

• Flexibilty to develop your own cache scheme<br />

• Template fragment cache<br />

• Can accept context variables<br />

• example (Get cache template for different users)<br />

22 Chapter 3. <strong>Conference</strong>s

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!