3. Analyzing Performance
Optimizing performance is a huge
✦
concern: Faster code = happy users!
Measure execution time
✦
Loop the code a few times
✦
Measure the difference:
✦
✦ (new Date).getTime();
4. Stack Profiling
jQuery Stack Profiler
✦
Look for problematic methods and plugins
✦
http://ejohn.org/blog/deep-profiling-
✦
jquery-apps/
6. Accuracy of
JavaScript Time
We’re measuring the performance of
JavaScript from within JavaScript!
http://ejohn.org/blog/accuracy-of-javascript-time/
11. Performance Tools
How can we get good numbers?
✦
We have to go straight to the source: Use
✦
the tools the browsers provide.
Tools:
✦
✦ Firebug Profiler
✦ Safari Profiler
✦ (Part of Safari 4)
✦ IE 8 Profiler
28. Strategy Games
Very server-side heavy
✦
✦ Most logic hidden from the user
Hard to cheat
✦
✦ Casual cheaters can’t change values
✦ Dedicated cheaters have to write full AI
29. Intelligence Games
Player’s intelligence/knowledge challenged
✦
Games could be quick or slow-paced
✦
Easy to cheat
✦
✦ Casual cheaters can open dictionary /
encyclopedia for answers
33. Speed/Accuracy Games
Require low latency
✦
Fast-paced and addictive
✦
JavaScript completely fails
✦
✦ Garbage Collection cycles freeze the
browser
None, or few, Accuracy-centric JavaScript
✦
games
Experienced coders can easily cheat
✦
✦ (A bot to hit the keys at the right time)
35. Guitar Hero
Heavily dependent upon accuracy
✦
✦ (Hit the right notes at the right time)
Garbage collection cycles absolutely kill
✦
the game
Rendering the play area is also difficult
✦
✦ And impossible in all browsers.
✦ (Use HTML 5 Canvas Element)
36. Failures on All Ends
Strategy: Slow, secret server-side code
✦
Intelligence: Easily cheatable
✦
Accuracy: Too hard to implement
✦
Optimal solution would be a combination
✦
of the above.
JavaScript games can’t be like other games,
✦
have to be unique.
37. What can make a fun game?
Quick play
✦
Points
✦
High Scores
✦
Head-to-head competition
✦
38. Wordsplay
Real-time Boggle
✦
Head-to-head with other players
✦
http://www.wordsplay.net/
39. Tringo
Tetris + Bingo (based on a Second Life
✦
game)
http://ejohn.org/tringo/
41. vs. Cheating
All words are recorded with exact time
✦
information
Game is “played back” on the server to
✦
verify score integrity using Server-Side JS
This data can be used to simulate a multi-
✦
player experience!
42. DeepLeap
Works in multiple languages
✦
✦ Dictionaries pulled from OpenOffice,
can build a Spanish version in < 5sec
Players can challenge each other head-to-
✦
head
Score multiplier (carry over from Guitar
✦
Hero)
47. Browser Support Grid
IE Firefox Safari Opera Chrome
Previous 6.0 2.0 3.0 9.5
Current 7.0 3.0 3.2 9.6 1.0
Next 8.0 3.1 4.0 10.0 2.0
jQuery Browser Support
48. Browser Support Grid
IE Firefox Safari Opera Chrome
Previous 3.0 9.5
6.0 2.0
Current 7.0 3.0 3.2 9.6 1.0
Next 8.0 3.1 4.0 2.0
10.0
jQuery 1.3 Browser Support
49. The Scaling Problem
The Problem:
✦
✦ jQuery has 6 test suites
✦ Run in 11 browsers
✦ (Not even including multiple platforms!)
All need to be run for every commit,
✦
patch, and plugin.
JavaScript testing doesn’t scale well.
✦
50. Distributed Testing
Hub server
✦
Clients connect and help run tests
✦
A simple JavaScript client that can be run
✦
in all browsers
✦ Including mobile browsers!
✦ TestSwarm
51. FF 3.5 FF 3.5 FF 3.5
IE 6
IE 6
FF 3 IE 6
Op 9
FF 3
IE 7
TestSwarm
IE 7
Test Suite Test Suite Test Suite
52. Manual Testing
Push tests to users who follow pre-defined
✦
steps
Answer ‘Yes’/’No’ questions which are
✦
pushed back to the server.
An effective way to distribute manual test
✦
load to dozens of clients.
53. TestSwarm.com
Incentives for top testers (t-shirts, books)
✦
Will be opening for alpha testing very soon
✦
Help your favorite JavaScript library
✦
become better tested!
http://testswarm.com
✦