Open lunixbochs opened 8 years ago
Take the signature/method examples from https://github.com/lunixbochs/struc/issues/35#issuecomment-180631405
This should result in a very good speedup without resorting to dynamically generated code yet, as we can cache function pointers with correct types.
For alternate number types like int struc:"uint32", we can use a lookup table to generate conversions like this:
int struc:"uint32"
switch outer { case int: return func(i int) uint32 { return uint32(i) } }
Or take the argjoy approach of IntToInt and see if type switching is still faster than outright reflection.
Take the signature/method examples from https://github.com/lunixbochs/struc/issues/35#issuecomment-180631405
This should result in a very good speedup without resorting to dynamically generated code yet, as we can cache function pointers with correct types.
For alternate number types like
int struc:"uint32"
, we can use a lookup table to generate conversions like this:Or take the argjoy approach of IntToInt and see if type switching is still faster than outright reflection.