-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
199 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,29 @@ | ||
const LENGTH = 10000; | ||
const LENGTH = 1e3; | ||
const ARRAY = new Array(LENGTH).fill(0); | ||
|
||
// TODO - Async benchmarks pending probe.gl update | ||
// async function *asyncIterator(array) { | ||
// for (const element of array) { | ||
// yield Promise.resolve(element); | ||
// } | ||
// } | ||
async function* asyncIterator(array) { | ||
for (const element of array) { | ||
yield Promise.resolve(element); | ||
} | ||
} | ||
|
||
export default function coreBench(bench) { | ||
return bench.group('Core Module - Async Iteration').add('Normal Iteration 10K', () => { | ||
bench.group('Core Module - Async Iteration'); | ||
|
||
bench.add('Sync Iteration over 1000 elements', () => { | ||
let sum = 0; | ||
for (const element of ARRAY) { | ||
sum += element; | ||
} | ||
return sum; | ||
}); | ||
// .addAsync('Async Iteration 10K', async () => { | ||
// let sum = 0; | ||
// for await (const element of asyncIterator(ARRAY)) { | ||
// sum += element; | ||
// } | ||
// return sum; | ||
// }); | ||
|
||
bench.addAsync('Async Iteration over 1000 elements', async () => { | ||
let sum = 0; | ||
for await (const element of asyncIterator(ARRAY)) { | ||
sum += element; | ||
} | ||
return sum; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import {JSONLoader} from '@loaders.gl/json'; | ||
import {load, loadInBatches} from '@loaders.gl/core'; | ||
|
||
import clarinetBench from './clarinet/clarinet.bench'; | ||
|
||
const GEOJSON_URL = '@loaders.gl/json/test/data/geojson-big.json'; | ||
|
||
export default async function jsonLoaderBench(suite) { | ||
// Test underlying clarinet library | ||
await clarinetBench(suite); | ||
|
||
suite.group('JSONLoader - loading from file'); | ||
|
||
suite.addAsync('load(JSONLoader) - Uses JSON.parse', async () => { | ||
await load(GEOJSON_URL, JSONLoader); | ||
}); | ||
|
||
suite.addAsync('loadInBatches(JSONLoader) - Uses Clarinet', async () => { | ||
const asyncIterator = await loadInBatches(GEOJSON_URL, JSONLoader); | ||
// const asyncIterator = await parseInBatches(STRING, JSONLoader); | ||
const data = []; | ||
for await (const batch of asyncIterator) { | ||
data.push(...batch.data); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.