npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

eada-cpu

v1.0.11

Published

FAISS-based high-performance KNN search addon for Node.js

Downloads

19

Readme

EADA-CPU 🚀

FAISS-based high-performance KNN search addon for Node.js

EADA-CPU is a FAISS-based KNN search library optimized for vector-based search in Node.js applications. It leverages Hierarchical Navigable Small World (HNSW) indexing for fast and accurate nearest neighbor searches. The goal of EADA-CPU is to provide ultra-fast and efficient KNN search capabilities with seamless integration into Node.js projects.

📌 Features

FAISS Integration – Uses Facebook's FAISS for efficient vector search
HNSW Indexing – Optimized for high-speed nearest neighbor search
Node.js Addon – Built with C++ and Node.js native addons (node-addon-api)
Customizable Parameters – Supports tunable HNSW settings (M, efSearch, efConstruction)
Lightweight & Efficient – Memory optimized using FAISS
Cross-Platform Support – Works on Linux, macOS, and Windows
Prebuilt Binaries – No need to compile from source for common platforms


🚀 Installation

1️⃣ Clone the Repository

git clone https://github.com/codie1982/eada-cpu.git
cd eada-cpu

2️⃣ Install Dependencies

npm install

3️⃣ Build the Project

npm run build

4️⃣ Run Tests

npm test

5️⃣ Optional: Clean Build Files

npm run clean

🛠 Build Process (Using CMake)

We have updated our build system to use CMake instead of node-gyp. The new process is as follows:

  1. CMake generates build files:

    cmake-js compile
  2. The compiled binary (eada.node) is placed in build/Release/ directory.

  3. If needed, clean the build:

    npm run clean

📂 Usage

1️⃣ Create a FAISS Index and Add Data

const eada = require('eada-cpu');

const testData = Array.from({ length: 10 }, () =>
    Array.from({ length: 128 }, () => Math.random())
);

console.log("🛠 Creating a new index...");
console.log(eada.indexKNN(testData));

2️⃣ Perform a KNN Search

const queryVector = testData[0]; // Use the first vector as the query
const k = 5; // Find 5 nearest neighbors

console.log("🔍 Performing KNN search...");
const searchResults = eada.searchKNN(queryVector, k);
console.log("🎯 Search Results:", searchResults);

3️⃣ Save and Load Index

console.log("💾 Saving index...");
eada.saveIndex("test_index.bin");

console.log("📂 Loading saved index...");
eada.loadIndex("test_index.bin");

🛠 Benchmark Results

FAISS vs EADA Performance Comparison

| Metric | FAISS | EADA | |--------|-------|------| | Index Load Time | 3.118 sec | 3.118 sec | | KNN Search Time | 4.405 ms | 5.123 ms | | Indexed Vectors | 7,000,000+ | 7,000,000+ | | Top-10 Search Results | ✅ Matched | ✅ Matched | | Total Indexing Time | 1:36:28 | 1:36:28 |

FAISS KNN Search Results

📢 Index dosyadan yükleniyor: EADA_index.bin ...
✅ Index başarıyla yüklendi. (Süre: 3.118 saniye)
🔍 KNN Arama başlatılıyor...
⏳ KNN Arama Süresi: 4.405 ms
🔍 KNN Sonuçları:
  ID: 1139880, Mesafe: 10.542609
  ID: 4941269, Mesafe: 12.801138
  ID: 3496633, Mesafe: 12.889940
  ID: 1953303, Mesafe: 13.096790
  ID: 1762100, Mesafe: 13.334504
  ID: 1604576, Mesafe: 13.368546
  ID: 1402832, Mesafe: 13.420458
  ID: 1091823, Mesafe: 13.444320
  ID: 859615, Mesafe: 13.497845
  ID: 1888149, Mesafe: 13.593676

EADA KNN Search Results

📢 Indexlenme Süresi: 1:36:28.218 (h:mm:ss.mmm)
📢 Index dosyaya kaydediliyor...
[INFO] Index EADA_index.bin olarak kaydediliyor...
[BAŞARILI] Index başarıyla kaydedildi: EADA_index.bin
📢 Index dosyadan yükleniyor...
[INFO] Index dosyadan yükleniyor: EADA_index.bin
[BAŞARILI] Index başarıyla yüklendi.
✅ Index başarıyla yüklendi.
🔍 KNN Arama başlatılıyor...
⏳ KNN Arama Süresi: 5.123 ms
🔍 KNN Arama tamamlandı! Süre: 3.695 ms
🔍 KNN Sonuçları:
  ID: 3508264, Mesafe: 12.694493
  ID: 3217653, Mesafe: 12.927071
  ID: 458092, Mesafe: 13.058410
  ID: 3119813, Mesafe: 13.112334
  ID: 489017, Mesafe: 13.123556
  ID: 1878676, Mesafe: 13.300370
  ID: 278932, Mesafe: 13.310304
  ID: 4284569, Mesafe: 13.365856
  ID: 4717959, Mesafe: 13.371505
  ID: 6358662, Mesafe: 13.386209

📜 License

This project is licensed under the MIT License.


🔥 Next Steps

Expanded README with detailed benchmark comparisonsIncluded cross-platform build instructionsImproved documentation for running, building, and testing