responsive interfaces

Post on 17-Aug-2015

17 Views

Category:

Software

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Responsive Interfaces

Baris Aydinoglu

August 12 2015

Agenda

I UI Thread

I Browser UI Thread

I Yielding with Timers

I Web Workers

UI Thread

Two jobs

I Draw UI

I Execute JS

rdquoNo UI updates while JS running

rdquoLong-running JS

dArrUnresponsive UI

Browser UI Thread

rdquoBrowser Limits

rdquoHow Long Is Too Long

I JS lt 100ms

rdquoHow Long Is Too Long

I JS lt 100ms

Yielding with Timers

Timer Basics

I Delay JS tasks gt100ms to yield UI update

Timer Precision

I Timer resolution is 15ms in Windows

I Delay lt15ms locks IE

I Recommended min 25ms

I Array processing with timers

I Splitting up tasks

Timer Example - v1

Timer Example - v2

Timer Example - v3

Timed Code

I 10000 item 25ms

I Total delay lt 50ms

rdquoHigher frequency

dArrSlower app

Web Workers

Worker Environment

I Asynchronous JS execution

I Not on the UI thread

I No UI delays

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

Agenda

I UI Thread

I Browser UI Thread

I Yielding with Timers

I Web Workers

UI Thread

Two jobs

I Draw UI

I Execute JS

rdquoNo UI updates while JS running

rdquoLong-running JS

dArrUnresponsive UI

Browser UI Thread

rdquoBrowser Limits

rdquoHow Long Is Too Long

I JS lt 100ms

rdquoHow Long Is Too Long

I JS lt 100ms

Yielding with Timers

Timer Basics

I Delay JS tasks gt100ms to yield UI update

Timer Precision

I Timer resolution is 15ms in Windows

I Delay lt15ms locks IE

I Recommended min 25ms

I Array processing with timers

I Splitting up tasks

Timer Example - v1

Timer Example - v2

Timer Example - v3

Timed Code

I 10000 item 25ms

I Total delay lt 50ms

rdquoHigher frequency

dArrSlower app

Web Workers

Worker Environment

I Asynchronous JS execution

I Not on the UI thread

I No UI delays

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

UI Thread

Two jobs

I Draw UI

I Execute JS

rdquoNo UI updates while JS running

rdquoLong-running JS

dArrUnresponsive UI

Browser UI Thread

rdquoBrowser Limits

rdquoHow Long Is Too Long

I JS lt 100ms

rdquoHow Long Is Too Long

I JS lt 100ms

Yielding with Timers

Timer Basics

I Delay JS tasks gt100ms to yield UI update

Timer Precision

I Timer resolution is 15ms in Windows

I Delay lt15ms locks IE

I Recommended min 25ms

I Array processing with timers

I Splitting up tasks

Timer Example - v1

Timer Example - v2

Timer Example - v3

Timed Code

I 10000 item 25ms

I Total delay lt 50ms

rdquoHigher frequency

dArrSlower app

Web Workers

Worker Environment

I Asynchronous JS execution

I Not on the UI thread

I No UI delays

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

Two jobs

I Draw UI

I Execute JS

rdquoNo UI updates while JS running

rdquoLong-running JS

dArrUnresponsive UI

Browser UI Thread

rdquoBrowser Limits

rdquoHow Long Is Too Long

I JS lt 100ms

rdquoHow Long Is Too Long

I JS lt 100ms

Yielding with Timers

Timer Basics

I Delay JS tasks gt100ms to yield UI update

Timer Precision

I Timer resolution is 15ms in Windows

I Delay lt15ms locks IE

I Recommended min 25ms

I Array processing with timers

I Splitting up tasks

Timer Example - v1

Timer Example - v2

Timer Example - v3

Timed Code

I 10000 item 25ms

I Total delay lt 50ms

rdquoHigher frequency

dArrSlower app

Web Workers

Worker Environment

I Asynchronous JS execution

I Not on the UI thread

I No UI delays

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

rdquoNo UI updates while JS running

rdquoLong-running JS

dArrUnresponsive UI

Browser UI Thread

rdquoBrowser Limits

rdquoHow Long Is Too Long

I JS lt 100ms

rdquoHow Long Is Too Long

I JS lt 100ms

Yielding with Timers

Timer Basics

I Delay JS tasks gt100ms to yield UI update

Timer Precision

I Timer resolution is 15ms in Windows

I Delay lt15ms locks IE

I Recommended min 25ms

I Array processing with timers

I Splitting up tasks

Timer Example - v1

Timer Example - v2

Timer Example - v3

Timed Code

I 10000 item 25ms

I Total delay lt 50ms

rdquoHigher frequency

dArrSlower app

Web Workers

Worker Environment

I Asynchronous JS execution

I Not on the UI thread

I No UI delays

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

rdquoLong-running JS

dArrUnresponsive UI

Browser UI Thread

rdquoBrowser Limits

rdquoHow Long Is Too Long

I JS lt 100ms

rdquoHow Long Is Too Long

I JS lt 100ms

Yielding with Timers

Timer Basics

I Delay JS tasks gt100ms to yield UI update

Timer Precision

I Timer resolution is 15ms in Windows

I Delay lt15ms locks IE

I Recommended min 25ms

I Array processing with timers

I Splitting up tasks

Timer Example - v1

Timer Example - v2

Timer Example - v3

Timed Code

I 10000 item 25ms

I Total delay lt 50ms

rdquoHigher frequency

dArrSlower app

Web Workers

Worker Environment

I Asynchronous JS execution

I Not on the UI thread

I No UI delays

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

Browser UI Thread

rdquoBrowser Limits

rdquoHow Long Is Too Long

I JS lt 100ms

rdquoHow Long Is Too Long

I JS lt 100ms

Yielding with Timers

Timer Basics

I Delay JS tasks gt100ms to yield UI update

Timer Precision

I Timer resolution is 15ms in Windows

I Delay lt15ms locks IE

I Recommended min 25ms

I Array processing with timers

I Splitting up tasks

Timer Example - v1

Timer Example - v2

Timer Example - v3

Timed Code

I 10000 item 25ms

I Total delay lt 50ms

rdquoHigher frequency

dArrSlower app

Web Workers

Worker Environment

I Asynchronous JS execution

I Not on the UI thread

I No UI delays

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

rdquoBrowser Limits

rdquoHow Long Is Too Long

I JS lt 100ms

rdquoHow Long Is Too Long

I JS lt 100ms

Yielding with Timers

Timer Basics

I Delay JS tasks gt100ms to yield UI update

Timer Precision

I Timer resolution is 15ms in Windows

I Delay lt15ms locks IE

I Recommended min 25ms

I Array processing with timers

I Splitting up tasks

Timer Example - v1

Timer Example - v2

Timer Example - v3

Timed Code

I 10000 item 25ms

I Total delay lt 50ms

rdquoHigher frequency

dArrSlower app

Web Workers

Worker Environment

I Asynchronous JS execution

I Not on the UI thread

I No UI delays

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

rdquoHow Long Is Too Long

I JS lt 100ms

rdquoHow Long Is Too Long

I JS lt 100ms

Yielding with Timers

Timer Basics

I Delay JS tasks gt100ms to yield UI update

Timer Precision

I Timer resolution is 15ms in Windows

I Delay lt15ms locks IE

I Recommended min 25ms

I Array processing with timers

I Splitting up tasks

Timer Example - v1

Timer Example - v2

Timer Example - v3

Timed Code

I 10000 item 25ms

I Total delay lt 50ms

rdquoHigher frequency

dArrSlower app

Web Workers

Worker Environment

I Asynchronous JS execution

I Not on the UI thread

I No UI delays

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

rdquoHow Long Is Too Long

I JS lt 100ms

Yielding with Timers

Timer Basics

I Delay JS tasks gt100ms to yield UI update

Timer Precision

I Timer resolution is 15ms in Windows

I Delay lt15ms locks IE

I Recommended min 25ms

I Array processing with timers

I Splitting up tasks

Timer Example - v1

Timer Example - v2

Timer Example - v3

Timed Code

I 10000 item 25ms

I Total delay lt 50ms

rdquoHigher frequency

dArrSlower app

Web Workers

Worker Environment

I Asynchronous JS execution

I Not on the UI thread

I No UI delays

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

Yielding with Timers

Timer Basics

I Delay JS tasks gt100ms to yield UI update

Timer Precision

I Timer resolution is 15ms in Windows

I Delay lt15ms locks IE

I Recommended min 25ms

I Array processing with timers

I Splitting up tasks

Timer Example - v1

Timer Example - v2

Timer Example - v3

Timed Code

I 10000 item 25ms

I Total delay lt 50ms

rdquoHigher frequency

dArrSlower app

Web Workers

Worker Environment

I Asynchronous JS execution

I Not on the UI thread

I No UI delays

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

Timer Basics

I Delay JS tasks gt100ms to yield UI update

Timer Precision

I Timer resolution is 15ms in Windows

I Delay lt15ms locks IE

I Recommended min 25ms

I Array processing with timers

I Splitting up tasks

Timer Example - v1

Timer Example - v2

Timer Example - v3

Timed Code

I 10000 item 25ms

I Total delay lt 50ms

rdquoHigher frequency

dArrSlower app

Web Workers

Worker Environment

I Asynchronous JS execution

I Not on the UI thread

I No UI delays

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

Timer Precision

I Timer resolution is 15ms in Windows

I Delay lt15ms locks IE

I Recommended min 25ms

I Array processing with timers

I Splitting up tasks

Timer Example - v1

Timer Example - v2

Timer Example - v3

Timed Code

I 10000 item 25ms

I Total delay lt 50ms

rdquoHigher frequency

dArrSlower app

Web Workers

Worker Environment

I Asynchronous JS execution

I Not on the UI thread

I No UI delays

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

I Array processing with timers

I Splitting up tasks

Timer Example - v1

Timer Example - v2

Timer Example - v3

Timed Code

I 10000 item 25ms

I Total delay lt 50ms

rdquoHigher frequency

dArrSlower app

Web Workers

Worker Environment

I Asynchronous JS execution

I Not on the UI thread

I No UI delays

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

Timer Example - v1

Timer Example - v2

Timer Example - v3

Timed Code

I 10000 item 25ms

I Total delay lt 50ms

rdquoHigher frequency

dArrSlower app

Web Workers

Worker Environment

I Asynchronous JS execution

I Not on the UI thread

I No UI delays

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

Timer Example - v2

Timer Example - v3

Timed Code

I 10000 item 25ms

I Total delay lt 50ms

rdquoHigher frequency

dArrSlower app

Web Workers

Worker Environment

I Asynchronous JS execution

I Not on the UI thread

I No UI delays

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

Timer Example - v3

Timed Code

I 10000 item 25ms

I Total delay lt 50ms

rdquoHigher frequency

dArrSlower app

Web Workers

Worker Environment

I Asynchronous JS execution

I Not on the UI thread

I No UI delays

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

Timed Code

I 10000 item 25ms

I Total delay lt 50ms

rdquoHigher frequency

dArrSlower app

Web Workers

Worker Environment

I Asynchronous JS execution

I Not on the UI thread

I No UI delays

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

rdquoHigher frequency

dArrSlower app

Web Workers

Worker Environment

I Asynchronous JS execution

I Not on the UI thread

I No UI delays

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

Web Workers

Worker Environment

I Asynchronous JS execution

I Not on the UI thread

I No UI delays

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

Worker Environment

I Asynchronous JS execution

I Not on the UI thread

I No UI delays

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

Worker Usage Example

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

Worker Communication

I Data-driven

I Inputoutput serialized

I No access to DOMBOM

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

Worker Communication Example

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

Loading External Files

I Blocks worker script

I NOT UI

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

Loading External File Example

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

Practical Usage

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

Practical Usage

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

Go Deeper

I http www html5rocks com en tutorials workers basics

I http w3c github io setImmediate

I http www w3 org TR html5 webappapis html timers

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

Thatrsquos all Folks

barisaydinoglugithubcombarisaydinoglu

barisaydinogluinfo

top related