Go - Interface value


  • Real type of an interface variable is decided dynamatically
  • Need be careful when comparing interface, panic will occur when real type is not comparable such as slice.
  • nil value assigned to an interface variable is different from nil pointer assigned to a variable
  • Ex. check is argument value nil in function sill get wrong result
  • Do not assign nil pointer to interface. Because dynamic type is not nil but dynapic value is nil, cause dynamic dispatch panic


沒有留言:

張貼留言

Lessons Learned While Benchmarking vLLM with GPU

Recently, I benchmarked vLLM on a GPU to better understand how much throughput can realistically be expected in an LLM serving setup. One ...