1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-09-09 05:30:44 +02:00

update match benchmark

This commit is contained in:
Thomas Wilkerling
2025-03-14 16:35:02 +01:00
parent 33fb61ac4e
commit dc8d04d211
20 changed files with 145 additions and 528 deletions

View File

@@ -1,51 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Benchmark</title>
</head>
<body>
<h2>Benchmark: bulksearch-0.1.3</h2><hr/>
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
<script src="https://cdn.jsdelivr.net/gh/nextapps-de/bulksearch@master/bulksearch.min.js"></script>
<script type="module">
import { suite } from "../../bench.js";
let lib;
suite["bulksearch"] = {
init: function(){
lib = new BulkSearch({
type: "short",
encode: 'extra',
multi: true
});
},
add: function(data){
for(let i = 0, len = data.length; i < len; i++){
lib.add(i, data[i]);
}
},
update: function(data){
for(let i = 0, len = data.length; i < len; i++){
lib.update(i, data[i]);
}
},
query: function(query){
return lib.search(query, { suggest: true });
}
};
</script>
</body>
</html>

View File

@@ -1,55 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, height=device-height">
<title>Benchmark</title>
</head>
<body>
<h2>Benchmark: bulksearch-0.1.3</h2><hr/>
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
<script src="https://cdn.jsdelivr.net/gh/nextapps-de/bulksearch@master/bulksearch.light.js"></script>
<script type="module">
import { suite } from "../../bench.js";
let lib;
suite["bulksearch"] = {
init: function(){
lib = new BulkSearch({
type: "short",
encode: "icase",
multi: false,
async: false,
cache: false,
worker: false
});
},
add: function(data){
for(let i = 0, len = data.length; i < len; i++){
lib.add(i, data[i]);
}
},
update: function(data){
for(let i = 0, len = data.length; i < len; i++){
lib.update(i, data[i]);
}
},
query: function(query){
return lib.search(query);
}
};
</script>
</body>
</html>

View File

@@ -1,51 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Benchmark</title>
</head>
<body>
<h2>Benchmark: flexsearch-0.7.0</h2><hr/>
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
<script type="module">
import Index from "../../../src/index.js";
//import Document from "../../../src/document.js";
import { suite } from "../../bench.js";
let lib;
suite["flexsearch-0.7.0-match"] = {
init: function(){
lib = new Index({ context: { depth: 2 } });
},
add: function(data){
for(let i = 0, len = data.length; i < len; i++){
lib.add(i, data[i]);
}
},
query: function(query){
return lib.search(query, 10, { suggest: true });
},
update: function(id){
for(let i = 0, len = data.length; i < len; i++){
lib.update(i, data[i]);
}
},
remove: function(id){
lib.remove(id);
}
};
</script>
</body>
</html>

View File

@@ -10,9 +10,8 @@
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
<script type="module">
import Index from "../../../src/index.js";
//import Document from "../../../src/document.js";
import { encode } from "../../../src/lang/latin/advanced.js";
import Index from "https://rawcdn.githack.com/nextapps-de/flexsearch/0.7.31/src/index.js";
import { encode } from "https://rawcdn.githack.com/nextapps-de/flexsearch/0.7.31/src/lang/latin/advanced.js";
import { suite } from "../../bench.js";
let lib;
@@ -20,35 +19,19 @@
suite["flexsearch-0.7.0-match"] = {
init: function(){
lib = new Index({
encode: encode,
tokenize: "reverse",
resolution: 20
});
},
add: function(data){
for(let i = 0, len = data.length; i < len; i++){
lib.add(i, data[i]);
}
},
query: function(query){
return lib.search(query, 10, { suggest: true });
},
update: function(id){
for(let i = 0, len = data.length; i < len; i++){
lib.update(i, data[i]);
}
},
remove: function(id){
lib.remove(id);
return lib.search(query, { suggest: true });
}
};

View File

@@ -10,10 +10,10 @@
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
<p style="color: #f00">This test is using query cache and is outside the competition! It is just there for completion.</p>
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/v0.8-preview/dist/flexsearch.light.min.js"></script>
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.light.min.js"></script>
<script type="module">
import EnglishPreset from "https://rawcdn.githack.com/nextapps-de/flexsearch/v0.8-preview/dist/module-min/lang/en.js";
import EnglishPreset from "https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/module-min/lang/en.js";
import { suite } from "../../bench.js";
let lib;

View File

@@ -9,10 +9,10 @@
<h2>Benchmark: flexsearch-0.8.0-soundex</h2><hr/>
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/v0.8-preview/dist/flexsearch.compact.min.js"></script>
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.compact.min.js"></script>
<script type="module">
import EnglishPreset from "https://rawcdn.githack.com/nextapps-de/flexsearch/v0.8-preview/dist/module-min/lang/en.js";
import EnglishPreset from "https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/module-min/lang/en.js";
import { suite } from "../../bench.js";
let lib;

View File

@@ -9,10 +9,10 @@
<h2>Benchmark: flexsearch-0.8.0</h2><hr/>
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/v0.8-preview/dist/flexsearch.light.min.js"></script>
<script src="https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/flexsearch.light.min.js"></script>
<script type="module">
import EnglishPreset from "https://rawcdn.githack.com/nextapps-de/flexsearch/v0.8-preview/dist/module-min/lang/en.js";
import EnglishPreset from "https://rawcdn.githack.com/nextapps-de/flexsearch/aff94f2b1d830e21463b237070f7e6f7eb556b82/dist/module-min/lang/en.js";
import { suite } from "../../bench.js";
let lib;

View File

@@ -1,39 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Benchmark</title>
</head>
<body>
<h2>Benchmark: flexsearch-ctx-0.7.0</h2><hr/>
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
<script src="../../dist/flexsearch.min.js"></script>
<script type="module">
import { suite } from "../../bench.js";
let lib;
suite["flexsearch-balance"] = {
init: function(){
lib = new FlexSearch("balance");
},
add: function(data){
for(let i = 0, len = data.length; i < len; i++){
lib.add(i, data[i]);
}
},
query: function(query){
return lib.search(query);
}
};
</script>
</body>
</html>

View File

@@ -1,39 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Benchmark</title>
</head>
<body>
<h2>Benchmark: flexsearch-ctx-0.7.0</h2><hr/>
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
<script src="../../dist/flexsearch.light.js"></script>
<script type="module">
import { suite } from "../../bench.js";
let lib;
suite["flexsearch-default"] = {
init: function(){
lib = new FlexSearch();
},
add: function(data){
for(let i = 0, len = data.length; i < len; i++){
lib.add(i, data[i]);
}
},
query: function(query){
return lib.search(query);
}
};
</script>
</body>
</html>

View File

@@ -1,52 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Benchmark</title>
</head>
<body>
<h2>Benchmark: flexsearch-ctx-0.7.0</h2><hr/>
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
<script src="../../dist/flexsearch.min.js"></script>
<script type="module">
import { suite } from "../../bench.js";
let lib;
suite["flexsearch-ctx"] = {
init: function(){
lib = new FlexSearch({
//encode: "icase",
tokenize: "strict",
threshold: 8,
resolution: 9,
depth: 1,
doc: {
id: "id",
field: "content"
}
});
},
add: function(data){
for(let i = 0, len = data.length; i < len; i++){
lib.add({
id: i,
content: data[i]
});
}
},
query: function(query){
return lib.search(query);
}
};
</script>
</body>
</html>

View File

@@ -1,39 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Benchmark</title>
</head>
<body>
<h2>Benchmark: flexsearch-ctx-0.7.0</h2><hr/>
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
<script src="../../dist/flexsearch.light.js"></script>
<script type="module">
import { suite } from "../../bench.js";
let lib;
suite["flexsearch-fast"] = {
init: function(){
lib = new FlexSearch("fast");
},
add: function(data){
for(let i = 0, len = data.length; i < len; i++){
lib.add(i, data[i]);
}
},
query: function(query){
return lib.search(query);
}
};
</script>
</body>
</html>

View File

@@ -1,39 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Benchmark</title>
</head>
<body>
<h2>Benchmark: flexsearch-ctx-0.7.0</h2><hr/>
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
<script src="../../dist/flexsearch.min.js"></script>
<script type="module">
import { suite } from "../../bench.js";
let lib;
suite["flexsearch-match"] = {
init: function(){
lib = new FlexSearch("match");
},
add: function(data){
for(let i = 0, len = data.length; i < len; i++){
lib.add(i, data[i]);
}
},
query: function(query){
return lib.search(query);
}
};
</script>
</body>
</html>

View File

@@ -1,38 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Benchmark</title>
</head>
<body>
<h2>Benchmark: flexsearch-ctx-0.7.0</h2><hr/>
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
<script src="../../dist/flexsearch.min.js"></script>
<script type="module">
import { suite } from "../../bench.js";
let lib;
suite["flexsearch-memory"] = {
init: function(){
lib = new FlexSearch("memory");
},
add: function(data){
for(let i = 0, len = data.length; i < len; i++){
lib.add(i, data[i]);
}
},
query: function(query){
return lib.search(query);
}
};
</script>
</body>
</html>

View File

@@ -1,38 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Benchmark</title>
</head>
<body>
<h2>Benchmark: flexsearch-ctx-0.7.0</h2><hr/>
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
<script src="../../dist/flexsearch.min.js"></script>
<script type="module">
import { suite } from "../../bench.js";
let lib;
suite["flexsearch-score"] = {
init: function(){
lib = new FlexSearch("score");
},
add: function(data){
for(let i = 0, len = data.length; i < len; i++){
lib.add(i, data[i]);
}
},
query: function(query){
return lib.search(query);
}
};
</script>
</body>
</html>

View File

@@ -1,38 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Benchmark</title>
</head>
<body>
<h2>Benchmark: flexsearch-ctx-0.7.0</h2><hr/>
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
<script src="../../dist/flexsearch.min.js"></script>
<script type="module">
import { suite } from "../../bench.js";
let lib;
suite["flexsearch-speed"] = {
init: function(){
lib = new FlexSearch("speed");
},
add: function(data){
for(let i = 0, len = data.length; i < len; i++){
lib.add(i, data[i]);
}
},
query: function(query){
return lib.search(query);
}
};
</script>
</body>
</html>

View File

@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, height=device-height">
<title>Benchmark: lunr-2.3.9</title>
</head>
<body>
<h2>Benchmark: lunr-2.3.9</h2><hr/>
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
<script src="https://cdn.jsdelivr.net/npm/lunr@2.3.9/lunr.min.js"></script>
<script type="module">
import { suite } from "../../bench.js";
let lib;
suite["lunr-match"] = {
init: function(){},
add: function(data){
lib = lunr(function(){
this.ref("id");
this.field("content");
for(let i = 0; i < data.length; i++){
this.add({
id: i,
content: data[i]
});
}
});
},
query: function(query){
return lib.search(query, { wildcard: lunr.Query.wildcard.LEADING });
// const result = lib.query(function(q) {
// q.term(query, { wildcard: lunr.Query.wildcard.LEADING })
// });
// for(let i = 0; i < result.length; i++){
// result[i] = parseInt(result[i].ref, 10);
// }
// return result;
}
};
</script>
</body>
</html>

View File

@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, height=device-height">
<title>Benchmark: ufuzzy-1.0.18</title>
</head>
<body>
<h2>Benchmark: ufuzzy-1.0.18</h2><hr/>
<h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
<div id="result" style="white-space: pre; font-family: Monospaced, monospace"></div>
<script src="https://rawcdn.githack.com/leeoniya/uFuzzy/main/dist/uFuzzy.iife.min.js"></script>
<script type="module">
import { suite } from "../../bench.js";
let uf, content;
suite["ufuzzy"] = {
init: function(){
let opts = {
alpha: "a-z",
intraMode: 9,
intraIns: 9,
intraSub: 9,
intraTrn: 9,
intraDel: 9
};
uf = new window.uFuzzy(opts);
},
add: function(data){
content = data;
},
query: function(query){
return uf.search(content, query)[0];
}
};
</script>
</body>
</html>