Mindex 是个小而快的 JavaScript 复合索引,灵感来源于 LokiJS。 Mindex 可以帮助用户在集合中查找对象,Mindex 可以迅速的搜索大型数据数组,可以返回数据的范围,还会对结果进行排序。Mindex 使用非常直观的查询语法,支持skip 和 offset ,可以迅速对结果进行分页。 Mindex 使得信息查找变得非常快速。 特性
使用 5 万条数据库数据进行基准测试,插入会比较慢,但是其他方面都有压倒性的优势: *********************** Mindex 性能测试 *********************** Testing insertRecord(record) Mindex 16.80 ops/sec, Native Array 45.51 ops/sec Mindex is 63% slower Testing get(key) Mindex 3485998.20 ops/sec, Native Array 642.11 ops/sec Mindex is 542799% faster Testing getAll(), get all records Mindex 374.92 ops/sec, Native Array 14.41 ops/sec Mindex is 2502% faster Testing removeRecord(key, value) Mindex 1955971.50 ops/sec, Native Array 220.43 ops/sec Mindex is 887260% faster 安装:Mindex 支持 Node v4.0+ npm install --save mindex 示例:
var Mindex = require('mindex')
var index = Mindex(['age'])
index.insertRecord({
id: 'John',
age: 25
})
index.insertRecord({
id: 'Darcy',
age: 28
})
index.insertRecord({
id: 'Jim',
age: 29
})
index.insertRecord({
id: 'Betty',
age: 25
})
// Get IDs by key
console.log(index.get(25)) // [ 'Betty', 'John' ]
// Get all IDs sorted by key (age)
console.log(index.getAll()) // [ 'Betty', 'John', 'Darcy', 'Jim' ]
// Get all IDs within a given range
console.log(index.query({'>': [22], '<': [29]})) // [ 'Betty', 'John', 'Darcy' ]
(责任编辑:最模板) |

Prestashop英文医疗护理网站
人气:209
男装网店商城|ecshop韩国
人气:773
Destoon B2B行业分类29328条阿
人气:3376
ecshop红色综合商城(推荐
人气:1599
Varmo英文综合商品商城Ma
人气:134
shopex4.85解密开源学习版
人气:5853