Finish Optimization.
Speed up to 10000x than the original one.
Small Update.
Merge pull request #1 from snowzjx/branch_optimization

Optimization.