General improvement. #2

Closed
wants to merge 2 commits into
from

2 participants

@leodutra
  • omited "{" "}" on some blocks;
  • faster operator for equality ("===");
  • fixed some jsHint pointings;
  • optimized a condition;
  • minor optimizations of size and performance.

:D

leodutra added some commits Mar 4, 2012
@leodutra leodutra General improvement.
 - omited "{" "}" on some blocks;
 - faster operator for equality ("===");
 - fixed some jsHint pointings;
 - optimized a condition;
 - minor optimizations of size and performance.
9851f46
@leodutra leodutra 8.76KB (3.36KB gzipped). Closure compiled. 8b1ec90
@leodutra leodutra closed this Mar 4, 2012
@leodutra leodutra reopened this Mar 4, 2012
@leodutra

Brian, please review "hasOwnProperty" substituition.
I don't expect negative values on the new version.
Please point me any mistakes and I'll come with another solution.

And nice job till here!

@bgrins
Owner

Thanks for the contribution!

A few notes:

  • The compiler should remove the extra braces, and I keep them in the source based on convention - I think it makes the blocks more explicit and easier to read.
  • All the === blocks are good changes.
  • Good catch on some of the mathRound type fixes - minimizing the size of the compressed source is definitely a priority.
  • hasOwnProperty: I would prefer to keep this in to prevent any ambiguity with the negative values as you mention. I would guess that it actually doesn't save too much space once compressed to use it as it probably gzips well, but it would be an interesting comparison in a different commit (maybe creating a hasOwnProperty function that takes in object and field).

Thanks for the interest and effort put into this commit - if you can revert some of the coding style changes ({} and hasOwnProperty) just to keep everything consistent I will push it into master.

@leodutra

I'll do it in almost no time. I'm finishing a "no-lib" slider for iOS and Android.
;)

@bgrins bgrins closed this Jul 23, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment