fix missing nil pointer check use simpler switch case add missing tests use for-loop instead of range add benchmark test codes
Co-authored-by: thinkerou <thinkerou@gmail.com> Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>