data-structure-typed/test/integration/index.html

52 lines
1 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
2023-09-26 04:49:33 +00:00
<html lang='en'>
<head>
2023-09-26 04:49:33 +00:00
<meta charset='UTF-8'>
2023-09-19 09:00:25 +00:00
<title>CDN Test</title>
2023-09-26 04:49:33 +00:00
<script src='https://cdn.jsdelivr.net/npm/data-structure-typed/umd/bundle.min.js'></script>
</head>
<body>
2023-09-26 04:49:33 +00:00
<div id='app'>
<ul class='modules'>
2023-09-19 09:00:25 +00:00
</ul>
</div>
<script defer>
const $modules = document.querySelector('.modules');
2023-10-05 02:37:42 +00:00
try {
const {AVLTree, Queue} = window.dataStructureTyped;
const avlTree = new AVLTree();
const $avlTree = document.createElement('li');
const $avlTreeSpan = document.createElement('span');
$avlTreeSpan.innerText = 'AVLTree';
$avlTree.append($avlTreeSpan);
avlTree.add(1, 1);
console.log(avlTree.BFS());
$modules.append($avlTree);
2023-09-19 09:00:25 +00:00
2023-10-05 02:37:42 +00:00
const queue = new Queue();
for (let i = 0; i < 1000000; i++) {
queue.enqueue(i);
}
let last = 0;
const startTime = performance.now();
for (let i = 0; i < 1000000; i++) {
last = queue.dequeue();
}
console.log(performance.now() - startTime);
} catch (e) {
2023-10-05 02:37:42 +00:00
console.error(e);
2023-09-19 09:00:25 +00:00
}
</script>
</body>
2023-09-19 09:00:25 +00:00
</html>