From e19e7cefe3e4517a1b8338de85723d4bde43e8b3 Mon Sep 17 00:00:00 2001 From: Oleksii Vykaliuk Date: Tue, 3 Dec 2024 12:39:56 +0100 Subject: [PATCH] perf(las): Bench laz-perf vs laz-rs versions of LasLoader --- modules/las/test/las.bench.ts | 24 ++++++++++++++++++++++++ test/bench/modules.js | 2 ++ 2 files changed, 26 insertions(+) create mode 100644 modules/las/test/las.bench.ts diff --git a/modules/las/test/las.bench.ts b/modules/las/test/las.bench.ts new file mode 100644 index 0000000000..0bad41c625 --- /dev/null +++ b/modules/las/test/las.bench.ts @@ -0,0 +1,24 @@ +// loaders.gl +// SPDX-License-Identifier: MIT +// Copyright (c) vis.gl contributors + +import {LAZPerfLoader, LAZRsLoader} from '@loaders.gl/las'; +import {fetchFile, load} from '@loaders.gl/core'; + +const LAZ_URL = '@loaders.gl/las/test/data/indoor.laz'; +// const GEO_PARQUET_URL = '@loaders.gl/parquet/test/data/geoparquet/airports.parquet'; + +export async function lazBench(suite) { + suite.group('ParquetLoader'); + + const response = await fetchFile(LAZ_URL); + const arrayBuffer = await response.arrayBuffer(); + + suite.addAsync('load(LAZPerfLoader) - LAZ load', {multiplier: 40000, unit: 'rows'}, async () => { + await load(arrayBuffer, LAZPerfLoader, {worker: false}); + }); + + suite.addAsync('load(LAZRsLoader) - LAZ load', {multiplier: 40000, unit: 'rows'}, async () => { + await load(arrayBuffer, LAZRsLoader, {worker: false}); + }); +} diff --git a/test/bench/modules.js b/test/bench/modules.js index ea684310b7..f5596ba74a 100644 --- a/test/bench/modules.js +++ b/test/bench/modules.js @@ -14,6 +14,7 @@ import dracoBench from '@loaders.gl/draco/test/draco.bench'; import excelBench from '@loaders.gl/excel/test/excel.bench'; import imageBench from '@loaders.gl/images/test/images.bench'; import jsonBench from '@loaders.gl/json/test/json-loader.bench'; +import {lazBench} from '@loaders.gl/las/test/las.bench'; // import mvtBench from '@loaders.gl/mvt/test/mvt-loader.bench'; import {parquetBench} from '@loaders.gl/parquet/test/parquet.bench'; // import shapefileBench from '@loaders.gl/shapefile/test/shapefile.bench'; @@ -42,6 +43,7 @@ export async function addModuleBenchmarksToSuite(suite) { await dracoBench(suite); await csvBench(suite); await excelBench(suite); + await lazBench(suite); // await i3sLoaderBench(suite); }