numpy optimization and algorithm optimization.