Measured on this machine (median of 6, 200 frames each): a frame of 8192 x 26 numbers under a data bar and an icon set, every visible cell drawn with one, takes 0.54 / 3.7 / 11.4 ms at 80x24 / 200x60 / 400x120, against 0.18 / 0.89 / 3.1 ms for the same numbers plain. Against main, frames of sheets without any of it moved by +2.3% to +3.6% (dense), and of laid-out and color-scaled sheets by +1.5% to +3.3%; the style the grid reads per cell is four bytes larger, for vertical alignment and border colors. The entry's check and the column width a rule's drawing needs are skipped on cells without one.
- commit
- 1e399dd7be22ccf6b94405556d560bc8387cf6a0
- parent
- e1ce9dfeb19d46beb18ea0a5ecfebc0d5c42524e
- author
- Dami <dami.etoile@gmail.com>
- kind
- test risk score 1.3 of 3, Jev's estimate
| M | internal/ | 2 | +- |
| M | internal/ | 23 | +++++++++++++++++++++++ |
| M | internal/ | 5 | ++--- |
@@ -60,7 +60,7 @@ func (m *Model) valueLine(lc *lineCtx, a sheet.Addr) bool {
6060 // that falls in a's, on the line that shows the merge's value, so the6161 // entry is as wide as the merge.6262 func (m *Model) entryPiece(lc *lineCtx, a sheet.Addr) (string, bool) {63- if m.mode != modeEnter && m.mode != modeEdit || m.away() {63+ if m.mode != modeEnter && m.mode != modeEdit || a.Row != m.cur.Row && lc.merges == nil || m.away() {6464 return "", false6565 }6666 if mg, ok := lc.mergeOf(a.Col); ok && mg.From == m.cur {@@ -49,9 +49,32 @@ func uiShapes() []uiShape {
4949 {"sparse-1M", func() *sheet.Sheet { return stress.Sparse(10000, 100, 1000) }},5050 {"scale-8192x26", scaled},5151 {"laidout-8192x26", func() *sheet.Sheet { return stress.Laidout(stress.Rows, 26) }},52+ {"bars-8192x26", barred},5253 }5354 }5455 56+// barred is dense-8192x26 with data bars over half its columns and57+// arrows over the rest, every visible cell drawn with one: what bars58+// and icons cost a frame.59+func barred() *sheet.Sheet {60+ s := stress.Dense(stress.Rows, 26)61+ var fs []sheet.CondFormat62+ for _, line := range []string{63+ `{"ranges":"A1:M8192","dataBar":{"color":"blue","min":{"type":"min"},"max":{"type":"max"}}}`,64+ `{"ranges":"N1:Z8192","iconSet":{"icons":"arrows","points":[{"type":"percent","value":"33"},{"type":"percent","value":"67"}]}}`,65+ } {66+ f, err := sheet.ParseCondFormat(line)67+ if err != nil {68+ panic(err)69+ }70+ fs = append(fs, f)71+ }72+ if s.LoadCondFormats(fs) > 0 {73+ panic("rules left out")74+ }75+ return s76+}77+5578 // scaled is dense-8192x26 under a 3-point color scale over all of it,5679 // every visible cell a shade: what conditional formatting costs a frame.5780 func scaled() *sheet.Sheet {@@ -205,14 +205,13 @@ func (m *Model) cellsText(lc *lineCtx, first int, spans []rowtext.Span) string {
205205 // data bar or icon, as a dropdown's chip (taking the look's ▾, which the206206 // chip holds), or plainly.207207 func (m *Model) cellText(lc *lineCtx, a sheet.Addr, sp rowtext.Span, look *sheet.Look, base *lipgloss.Style, colored bool, shade theme.Shade, shaded bool) string {208- w := m.sheet.ColWidth(a.Col)209208 switch {210209 case look.Bar || look.Icon != "" || look.ValueHidden:211- return m.barText(sp, w, look, base, colored, m.valueLine(lc, a))210+ return m.barText(sp, m.sheet.ColWidth(a.Col), look, base, colored, m.valueLine(lc, a))212211 case look.Dropdown && look.Display != sheet.DropArrow:213212 chip, ok := "", false214213 if look.Display == sheet.DropChip && !colored && sp.Owner == a.Col && m.valueLine(lc, a) {215- chip, ok = m.chipText(sp, w)214+ chip, ok = m.chipText(sp, m.sheet.ColWidth(a.Col))216215 }217216 if ok || look.Display == sheet.DropPlain {218217 look.Dropdown = false // no ▾ at the right