Skip to content

Commit

Permalink
ADD minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ts-thomas committed Jun 5, 2021
1 parent 6693992 commit e3d3483
Show file tree
Hide file tree
Showing 33 changed files with 221 additions and 188 deletions.
2 changes: 1 addition & 1 deletion bench/data/gulliver.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bench/dist/flexsearch.light.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 15 additions & 12 deletions bench/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@
const list = Mikado(document.getElementById("lib"), "lib", options);

const modes = window.location.hash.indexOf("modes") !== -1;
const encode = window.location.hash.indexOf("encode") !== -1;
let keep;
let repeat;
let index = -1;

let lib = shuffle(modes ? [
let lib = shuffle(modes || encode ? [

"flexsearch-balance", "flexsearch-default", "flexsearch-fast",
"flexsearch-match", "flexsearch-memory", "flexsearch-score",
"flexsearch-speed"
]:[
"bm25", "bulksearch", "elasticlunr",
"flexsearch", "flexsearch-ctx", "fuse",
"flexsearch", "flexsearch-0.6.3", "fuse",
"fuzzysearch", "js-search", "jsii",
"lunr", "wade"
]);
Expand Down Expand Up @@ -49,8 +50,10 @@

}).listen("click").listen("change");

const test = [
const test = encode ? [

"size", "memory", "encode"
]:[
"size", "memory",
"add", "query-single",
"query-multi", "not-found"
Expand All @@ -64,21 +67,21 @@
"bulksearch": 1,
"elasticlunr": 1,
"flexsearch": 1,
"flexsearch-ctx": 1,
"flexsearch-0.6.3": 1,
"fuse": 1,
"fuzzysearch": 1,
"js-search": 1,
"jsii": 1,
"lunr": 1,
"wade": 1,

"flexsearch-balance": 2.8,
"flexsearch-default": 2.8,
"flexsearch-fast": 2.8,
"flexsearch-match": 2.8,
"flexsearch-memory": 2.8,
"flexsearch-score": 7.1,
"flexsearch-speed": 7.1,
"flexsearch-balance": 3.0,
"flexsearch-default": 3.0,
"flexsearch-fast": 3.0,
"flexsearch-match": 3.0,
"flexsearch-memory": 3.0,
"flexsearch-score": 3.0,
"flexsearch-speed": 3.0
};

for(let x = 0; x < lib.length; x++){
Expand Down Expand Up @@ -110,7 +113,7 @@
const tmp = Object.assign({}, current[index]);
tmp[test[2]] = "run...";
mikado.update(mikado.node(index), tmp);
iframe.src = "test/" + lib[index].toLowerCase() + "/" + ("?duration=" + duration);
iframe.src = "test/" + lib[index].toLowerCase() + "/" + "?duration=" + duration + (encode ? "&encode=true" : "");
}

function get_score(){
Expand Down
20 changes: 20 additions & 0 deletions bench/test/flexsearch-0.6.3/flexsearch.light.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,40 @@
<title>Benchmark</title>
</head>
<body>
<h2>Benchmark: flexsearch-ctx-0.7.0</h2><hr/>
<h2>Benchmark: flexsearch-0.6.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="../../dist/flexsearch.light.js"></script>
<!--<script src="module/config.js"></script>-->
<!--
<script src="../../node_modules/flexsearch/src/config.js"></script>
<script type="module" src="../../node_modules/flexsearch/src/bundle.js"></script>
-->
<script src="flexsearch.light.js"></script>
<script type="module">

import { suite } from "./../../bench.js";
//import FlexSearch from "./module/flexsearch.js";
//import FlexSearch from "../../node_modules/flexsearch/src/bundle.js";

let lib;

suite["flexsearch-ctx"] = {
suite["flexsearch"] = {

init: function(){

lib = new FlexSearch({

//encode: "icase",
tokenize: "strict",
threshold: 8,
resolution: 9,
threshold: 99999,
resolution: 99999,
depth: 1
});

window.test = lib;
},
add: function(data){

for(let i = 0, len = data.length; i < len; i++){

lib.add(i, data[i]);
}
},
Expand Down
1 change: 1 addition & 0 deletions bench/test/flexsearch-balance/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ <h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
add: function(data){

for(let i = 0, len = data.length; i < len; i++){

lib.add(i, data[i]);
}
},
Expand Down
3 changes: 2 additions & 1 deletion bench/test/flexsearch-default/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<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 src="../../dist/flexsearch.light.js"></script>
<script type="module">

import { suite } from "./../../bench.js";
Expand All @@ -24,6 +24,7 @@ <h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
add: function(data){

for(let i = 0, len = data.length; i < len; i++){

lib.add(i, data[i]);
}
},
Expand Down
3 changes: 2 additions & 1 deletion bench/test/flexsearch-fast/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<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 src="../../dist/flexsearch.light.js"></script>
<script type="module">

import { suite } from "./../../bench.js";
Expand All @@ -24,6 +24,7 @@ <h4>Indexed Text: "Gulliver's Travels" (Swift Jonathan 1726)</h4>
add: function(data){

for(let i = 0, len = data.length; i < len; i++){

lib.add(i, data[i]);
}
},
Expand Down
18 changes: 13 additions & 5 deletions bench/test/flexsearch/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,40 @@ <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 src="../../node_modules/flexsearch/src/config.js"></script>
<script type="module" src="../../node_modules/flexsearch/src/bundle.js"></script>
<script src="src/config.js"></script>
<script type="module" src="src/bundle.js"></script>
-->

<script src="../../dist/flexsearch.light.js"></script>

<script type="module">

import { suite } from "./../../bench.js";
//import { text_data } from "./../../data/gulliver.js";
//import FlexSearch from "../../node_modules/flexsearch/src/bundle.js";

let lib;
let lib, split = /[^a-z]+/;

suite["flexsearch"] = {

init: function(){

lib = new FlexSearch({

//encode: "icase",
encode: str => str.toLowerCase().split(split),
tokenize: "strict",
threshold: 8,
resolution: 9
resolution: 9,
depth: 1
});

//window.test = lib;
//window.data = text_data;
},
add: function(data){

for(let i = 0, len = data.length; i < len; i++){

lib.add(i, data[i]);
}
},
Expand Down
Loading

0 comments on commit e3d3483

Please sign in to comment.