Window phone programing pain and how to deal with

726 views
670 views

Published on

Published in: Technology, Health & Medicine
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
726
On SlideShare
0
From Embeds
0
Number of Embeds
25
Actions
Shares
0
Downloads
12
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Window phone programing pain and how to deal with

  1. 1. Windows Phone programming: pain and how to deal with Nguyen Thai Son
  2. 2. Agenda 1. Image Cache - Why? What we need? How to used? 2. LINQ - Tip and trick to improve performance
  3. 3. Image Cache - Why? What we need? How to used?
  4. 4. 1.1 Image Cache mechanism in WP • Image has been cache in memory and has been release by garbage collector • Cache policy compliance with HTTP/1.1 Cache Control directive ‒ Support Etag, max-age, Expires, Last-Modified …
  5. 5. 1.2 Why we need other Image Cache? • Windows Phone OS just cache your image in one session • Current HTTP/1.1 Cache Control directive config is not the best • Need control memory consume and Image life cycle
  6. 6. 1.3 What we need to Cache Image
  7. 7. Local Cache • Organize by folder • Used FIFO rule to roll cache
  8. 8. 1.4 How to used • Cache every thing you can ‒ Better on Control memory • Short cache Temporary Image – which something like this HTTP/1.1 302 OK Location: /default Cache-Control: no-store, no-cache, must-revalidate Date: Fri, 05 Jul 2013 20:05:03 GMT Content-Length: 0
  9. 9. How to used (cont) • Only take what you need • Download Image from Network should be held as Stack and have limit Stack size 1 2 3 4
  10. 10. How to used (cont) • Scheduled to clean up local cache to avoid waste on disk - event permanent Image
  11. 11. LINQ - Tip and trick to improve performance
  12. 12. 2.1.Existing problems with LINQ • Write time increased when used one instance of DataContext many time 0 50 100 150 200 250 50 100 150 200 250 300 350 400 450 500 550 600 650 700 750 800 850 900 950 1000 Write time One instance 50 item / instance 1 item / instance
  13. 13. Existing problems with LINQ (cont) • Read time increased rapidly when amount of record is growing 100 record 20K record Read time (one record) 15 ms 242 ms
  14. 14. 2.2.How to improve • Write batch of Query Time (ms) Write each query (1000 query) 17866 Write batch query(1000 query) 1835
  15. 15. How to improve (cont) • Used CompiledQuery with Query has been called frequently ‒ Translate Linq query to SQL query => Run the query => Retrieve the data 100 times 3000 times Non Compiled Query 2427 ms 101039 ms Compiled Query 739 ms 50702 ms
  16. 16. How to improve (cont) • Only take which Entity you need 17 20K Record Count Full Entity 2803 Count One Entity 607

×