Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: B3DMLoader/I3DMLoader 不必要内存开销 #233

Closed
jiangheng90 opened this issue Jun 26, 2023 · 0 comments
Closed

[BUG]: B3DMLoader/I3DMLoader 不必要内存开销 #233

jiangheng90 opened this issue Jun 26, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@jiangheng90
Copy link
Contributor

Bug描述

B3DMLoaderBaseI3DMLoaderBase中使用buffer.slice对原有内存的拷贝
以对FeatureTable的构造为例其中一段代码

const featureTableStart = 28;
const featureTableBuffer = buffer.slice(
    featureTableStart,
    featureTableStart + featureTableJSONByteLength + featureTableBinaryByteLength,
);
const featureTable = new FeatureTable(
    featureTableBuffer,
    0,
    featureTableJSONByteLength,
    featureTableBinaryByteLength,
);

该部分会产生额外的内存开销

在3DTiles的大规模数据渲染实践中内存是非常宝贵的系统资源,引用一小段cesium 106版本对于featureTable的处理

let featureTableJson;
if (featureTableJsonByteLength === 0) {
  featureTableJson = {
    BATCH_LENGTH: defaultValue(batchLength, 0),
  };
} else {
  featureTableJson = getJsonFromTypedArray(
    uint8Array,
    byteOffset,
    featureTableJsonByteLength
  );
  byteOffset += featureTableJsonByteLength;
}

const featureTableBinary = new Uint8Array(
  arrayBuffer,
  byteOffset,
  featureTableBinaryByteLength
);
byteOffset += featureTableBinaryByteLength;

其中arraybuffer是直接来自下载数据

@jiangheng90 jiangheng90 added the bug Something isn't working label Jun 26, 2023
jiangheng90 pushed a commit to jiangheng90/orillusion that referenced this issue Jun 26, 2023
X-OldGentleMan pushed a commit that referenced this issue Jun 26, 2023
@lslzl3000 lslzl3000 mentioned this issue Jun 28, 2023
@lslzl3000 lslzl3000 mentioned this issue Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant