Ping-pong game with JavaScript and Canvas
From a once-over,


Short 1 letter variables are terrible ( except for x and y ), b, p and W are just terrible
Also please spellcheck your variables: padles -> paddles
You should only detect collision when the ball is going to the left and gets in the danger-zone or when it is going to the right and getting in the danger-zone. So instead of doing 8 accesses, 1 AND and 4 sums (if(b.x + ball.r &gt;= p.x + p.w &amp;&amp; b.x - ball.r &lt;= p.x + p.w) {) you should rather do something like 

if( deltaX &lt; 0 &amp;&amp; ball.x &lt; someLimit ){
  testCollision( ball , leftPaddle );
} else if( ball.x &gt; someOtherLimit  ) {
  testCollision( ball , rightPaddle );
}


Where deltaX is the amount of pixels the ball is moving over the X axis, this should make paddle collision a lot more efficient
Please don't use magical constants, in this case I see 25 all over the place
Same for the keycodes, you should use constants for those