Skip to content

Optimize vectorlayer performance #1042

Closed
@deyihu

Description

@deyihu

maptalks's version and what browser you use?

Issue description

   for (let i = 0, len = this.layer._geoList.length; i < len; i++) {
            this.checkGeo(this.layer._geoList[i]);
    }
 const extent2D = painter.get2DExtent(this.resources, TEMP_EXTENT);
        if (!extent2D || !extent2D.intersects(this._displayExtent)) {
            return;
        }
        if (painter.hasPoint()) {
            this._hasPoint = true;
        }
  • this.containerOffset = offset || map._pointToContainerPoint(renderer.southWest)._add(0, -map.height);
    It is not necessary to calculate every time, and the data on the same layer should be calculated only once
   this.containerOffset = offset || layer.containerOffset || map._pointToContainerPoint(renderer.southWest)._add(0, -map.height);
  • Do not use intrinsic functions

function sector(ctx, x, y, radius, startAngle, endAngle) {

function bezierEllipse(x, y, a, b, b1) {

function interpolate(t0, t1, x1, y1, bx1, by1, bx2, by2, x2, y2) {

function getCubicControlPoints(x0, y0, x1, y1, x2, y2, x3, y3, smoothValue, t) {

function fillWithPattern(p1, p2) {

Please provide a reproduction URL (on any jsfiddle like site)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions