、
FileSystemManager.writeFile 效率问题FileSystemManager.writeFile 感觉这个接口运行效率有问题,开发者工具上需要几百ms,真机上平均需要50ms。当写入大量文件到本地时,这一块会卡很久。 [代码]Log.info(`write file ${path}, buffer size [${size}]`);[代码] [代码]const bufferToWrite = [代码][代码]new[代码] [代码]Uint8Array(size);[代码][代码]bufferToWrite.set(window.Module.HEAPU8.subarray(buffer, buffer + size));[代码] [代码]try[代码] [代码]{[代码][代码] [代码][代码]Log.info(`check path`);[代码][代码] [代码][代码]this[代码][代码].checkPath(path);[代码][代码] [代码][代码]Log.info(`write start`);[代码][代码] [代码][代码]fs.writeFileSync(path, bufferToWrite.buffer, `hex`);[代码][代码] [代码][代码]// fs.writeFile({ filePath: path, data: bufferToWrite.buffer, encoding: `hex` });[代码][代码] [代码][代码]Log.info(`write end`);[代码][代码]} [代码][代码]catch[代码] [代码](e) {[代码][代码] [代码][代码]Log.error(`write file ${path} failed.`);[代码][代码] [代码][代码]console.error(e);[代码][代码] [代码][代码]return[代码] [代码]0;[代码][代码]}[代码] [图片] 附一个安卓运行结果: [图片]
2021-08-15