Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
js search
(version: 0)
Comparing performance of:
Lunr vs js search vs minisearch
Created:
5 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src="https://unpkg.com/lunr/lunr.js"></script> <script type="text/javascript" src="https://rawgit.com/bvaughn/js-search/1.2.0/dist/js-search.js"></script> <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/minisearch@2.2.2/dist/umd/index.min.js"></script> <script> Benchmark.prototype.setup = function() { 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(); }; </script>
Tests:
Lunr
var idx = lunr(function () { this.ref('isbn'); this.field('title'); this.field('author'); books.forEach(function (doc) { this.add(doc) }, this); })
js search
var search = new JsSearch.Search('isbn'); search.searchIndex = new JsSearch.TfIdfSearchIndex('isbn'); search.addIndex('title'); search.addIndex('author'); search.addDocuments(books);
minisearch
var miniSearch = new MiniSearch({ fields: ['isbn', 'title', 'author'], // fields to index for full-text search }); miniSearch.addAll(books)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Lunr
js search
minisearch
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 18_3_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3.1 Mobile/15E148 Safari/604.1
Browser/OS:
Mobile Safari 18 on iOS 18.3.2
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Lunr
4966275.5 Ops/sec
js search
12087381.0 Ops/sec
minisearch
2221029.2 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
Measuring the performance of JavaScript search libraries can be complex, but I'll break it down for you. The provided JSON represents three benchmark test cases: 1. **Lunr**: This test case uses the Lunr library to create an index and add documents (books) to it. The `lunr` function is defined with three fields: ISBN, title, and author. 2. **js search**: This test case uses a custom JavaScript search library (not an official one) called "js search" to create a search index and add documents (books) to it. It defines two search indexes: one for the ISBN field using TF-IDF and another for the title and author fields. 3. **minisearch**: This test case uses the Minisearch library to create an index and add documents (books) to it. The `MiniSearch` constructor is configured with three fields: ISBN, title, and author. Let's discuss each approach: **Lunr** Pros: * Easy to use: Lunr provides a simple API for creating indexes and adding documents. * Fast indexing: Lunr uses a disk-based indexing algorithm, which can be faster than in-memory algorithms used by some other libraries. * Strong support for advanced search features like faceting and filtering. Cons: * Limited customization: While Lunr is flexible, it has limited options for customizing the indexing and searching process. * Not as lightweight as other options **js search** Pros: * Highly customizable: The custom JavaScript search library allows developers to tailor the search experience to their specific needs. * Lightweight: As a custom library, js search can be more optimized for performance than some other libraries. Cons: * Steeper learning curve: Developing and maintaining a custom library requires programming expertise and time. * Less support for advanced features: While js search provides basic search functionality, it may lack the advanced features offered by other libraries like Lunr or Minisearch. **Minisearch** Pros: * Lightweight: Minisearch is a compact library that's easy to integrate into applications. * Fast indexing: Like Lunr, Minisearch uses a disk-based indexing algorithm for fast performance. * Simple API: The `MiniSearch` constructor provides an easy-to-use interface for creating indexes and adding documents. Cons: * Limited customization: While Minisearch is flexible, it has fewer options for customizing the indexing and searching process compared to Lunr or js search. * Not as widely supported as other libraries Other alternatives to consider: * **Sphinx**: An open-source search engine library that's highly customizable but can be resource-intensive. * **OpenSearch**: A cloud-native search engine that offers a range of features, including faceting and filtering, but may require more setup and configuration. * **Algolia**: A commercial search-as-a-service platform that provides robust indexing and searching capabilities but requires subscription and has limitations on customization. When testing these libraries, it's essential to consider factors like performance, ease of use, and customizability to determine which one best suits your project's needs.
Related benchmarks:
Fuzzy search 4
Comparison Ajax, Fecth and XHR
js browser search
js search benchmark
Comments
Confirm delete:
Do you really want to delete benchmark?