PgBiel / typst-tablex

More powerful and customizable tables in Typst
MIT License
370 stars 12 forks source link

Very slow performance when table is spread across multiple pages #63

Closed Andrew15-5 closed 12 months ago

Andrew15-5 commented 12 months ago

If the table is small and can fit in 1 page, the performance is great, but when it is broken into parts on several pages, each edit compiles in 5 or 6 seconds.

#import "@preview/tablex:0.0.5": tablex, rowspanx, colspanx

#set page(margin: 2cm)

#let data = csv("./test.csv").flatten()

#let table-cells = ()

#for (i, a) in data.enumerate() {
  let prev = [---]
  let middle = [---]
  if i > 0 {
    prev = data.at(i - 1)
    middle = calc.abs(float(a) - float(prev)) / 2
  }
  let row = (i, prev, a, "n", middle).map(n => [$#n$])
  table-cells.push(row)
}

// #let table-cells = table-cells.slice(0, 20)

#set text(size: 11pt)
#set align(center)
#tablex(
  columns: 5,
  align: center + horizon,
  header-rows: 2,
  repeat-header: true,
  rowspanx(2)[],
  colspanx(2)[],
  rowspanx(2)[],
  rowspanx(2)[],
  [],
  [],
  ..table-cells.flatten(),
)

test.csv

PgBiel commented 12 months ago

This is tracked by #5. Thanks for the report!