optimizations
This commit is contained in:
@@ -97,18 +97,14 @@ func (h *Hash) Compare(other Object) int {
|
||||
return -1
|
||||
}
|
||||
for _, pair := range h.Pairs {
|
||||
left := pair.Value
|
||||
hashed := left.(Hasher)
|
||||
hashed := pair.Value.(Hasher)
|
||||
right, ok := obj.Pairs[hashed.Hash()]
|
||||
if !ok {
|
||||
return -1
|
||||
}
|
||||
cmp, ok := left.(Comparable)
|
||||
if !ok {
|
||||
return -1
|
||||
}
|
||||
if cmp.Compare(right.Value) != 0 {
|
||||
return cmp.Compare(right.Value)
|
||||
val := pair.Value.Compare(right.Value)
|
||||
if val != 0 {
|
||||
return val
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user