MCPcopy Create free account
hub / github.com/cogentcore/core / RealQuickRatio

Method RealQuickRatio

texteditor/difflib/bytes/bytes.go:580–583  ·  view source on GitHub ↗

RealQuickRatio returns an upper bound on ratio() very quickly. This isn't defined beyond that it is an upper bound on .Ratio(), and is faster to compute than either .Ratio() or .QuickRatio().

()

Source from the content-addressed store, hash-verified

578// This isn't defined beyond that it is an upper bound on .Ratio(), and
579// is faster to compute than either .Ratio() or .QuickRatio().
580func (m *SequenceMatcher) RealQuickRatio() float64 {
581 la, lb := len(m.a), len(m.b)
582 return calculateRatio(min(la, lb), la+lb)
583}
584
585func count_leading(line []byte, ch byte) (count int) {
586 // Return number of `ch` characters at the start of `line`.

Callers 3

TestSequenceMatcherRatioFunction · 0.45
FancyReplaceMethod · 0.45

Calls 1

calculateRatioFunction · 0.70

Tested by 2

TestSequenceMatcherRatioFunction · 0.36