Skip to content

Commit

Permalink
第8次优化 516 ms
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Feb 2, 2024
1 parent 3ea1874 commit 5fb5c0f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fastReflect/typeMeta.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ func (receiver *TypeMeta) parseType() {
receiver.MapType = types.GetDictionaryMapType(receiver.ReflectType)
// key type
keyType := receiver.MapType.Key()
keyVal := reflect.New(keyType).Elem().Interface()
receiver.keyHashCode = PointerOf(keyVal).HashCode
keyVal := reflect.New(keyType).Elem()
receiver.keyHashCode = PointerOfValue(keyVal).HashCode

// value type
receiver.setItemHashCode(receiver.MapType.Elem())
Expand Down Expand Up @@ -195,8 +195,8 @@ func (receiver *TypeMeta) parseType() {

func (receiver *TypeMeta) setItemHashCode(itemType reflect.Type) {
if itemType.Kind() != reflect.Interface {
itemVal := reflect.New(itemType).Elem().Interface()
receiver.itemHashCode = PointerOf(itemVal).HashCode
itemVal := reflect.New(itemType).Elem()
receiver.itemHashCode = PointerOfValue(itemVal).HashCode
} else {
receiver.itemHashCode = anyNil.HashCode
}
Expand Down

0 comments on commit 5fb5c0f

Please sign in to comment.