cetz-package / cetz

CeTZ: ein Typst Zeichenpaket - A library for drawing stuff with Typst.

Home Page:https://cetz-package.github.io

Repository from Github https://github.comcetz-package/cetzRepository from Github https://github.comcetz-package/cetz

Can the program performance be optimized?

sky126 opened this issue · comments

image

Can the program performance be optimized? There are too many loops. Are the following two pieces of code repeated?

 for value in line-data {
    if x-domain-min > value.at(0) {
      x-domain-min = value.at(0)
    }
    if x-domain-max < value.at(0) {
      x-domain-max = value.at(0)
    }

    if y-domain-min > value.at(1) {
      y-domain-min = value.at(1)
    }
    if y-domain-max < value.at(1) {
      y-domain-max = value.at(1)
    }
  }

image

I hope it can be improved. The clipping algorithm is quite naive. If you can find any perf. Improvements, feel free to open a PR. Currently, I do not have the time to do it.

I've been looking at the code for a few days, but I still don't understand it very well.

I've added some minor performance improvements with #814.