Skip to content

Commit

Permalink
ast: Only realizing lazyObj when Compare() is called on other obj…
Browse files Browse the repository at this point in the history
…ect type (#6060)

This PR pulls out only the performance fix to lazyObj from #6040.

Signed-off-by: Johan Fylling <[email protected]>
  • Loading branch information
johanfylling authored Jun 29, 2023
1 parent 511018e commit 86ec33e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ast/term.go
Original file line number Diff line number Diff line change
Expand Up @@ -1861,6 +1861,13 @@ func (l *lazyObj) force() Object {
}

func (l *lazyObj) Compare(other Value) int {
o1 := sortOrder(l)
o2 := sortOrder(other)
if o1 < o2 {
return -1
} else if o2 < o1 {
return 1
}
return l.force().Compare(other)
}

Expand Down

0 comments on commit 86ec33e

Please sign in to comment.