JS Search vs Lunr JS - Building Index (v2)

Revision 2 of this benchmark created on


Preparation HTML

<script type="text/javascript" src="https://rawgit.com/olivernn/lunr.js/master/lunr.js"></script>
<script type="text/javascript" src="https://rawgit.com/bvaughn/js-search/master/dist/js-search.js"></script>

Setup

var books = [];
    var xmlhttp = new XMLHttpRequest();
    xmlhttp.onreadystatechange = function() {
      if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
        var json = JSON.parse(xmlhttp.responseText);
    
        books = json.books;
      }
    }
    xmlhttp.open('GET', 'http://bvaughn.github.io/js-search/books.json', true);
    xmlhttp.send();

Test runner

Ready to run.

Testing in
TestOps/sec
JS Search: Building index
var jsSearch = new JsSearch('isbn');
jsSearch.addIndex('title');
jsSearch.addIndex('author');
jsSearch.addDocuments(books);
ready
Lunr JS: Building index
var lunrJsIndex = new lunr.Index

lunrJsIndex.field('title')
lunrJsIndex.field('author')
lunrJsIndex.ref('isbn')

for (var i = 0, length = books.length; i < length; i++) {
  lunrJsIndex.add(books[i]);
}
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by Brian Vaughn on
  • Revision 2: published on
  • Revision 3: published by Brian Vaughn on
  • Revision 4: published by Brian Vaughn on
  • Revision 5: published by Brian Vaughn on