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

@sukryu/aethel-ts

v0.1.0

Published

High-performance, type-safe data structure and algorithm library for Node.js

Downloads

141

Readme

Aethel.TS

High-Performance, Type-Safe Data Structure and Algorithm Library for Node.js

npm version license

📥 Installation

npm install @sukryu/aethel-ts

Or with yarn:

yarn add @sukryu/aethel-ts

🎯 Project Goals

Aethel.TS challenges the limitations of native JavaScript data structures (Array, Map, Set) in high-throughput Node.js environments by providing custom, production-ready implementations with:

  • Superior Performance: Optimized data structures that overcome O(N) bottlenecks in native implementations
  • Type Safety: Full TypeScript support with generics and strict type checking
  • Go-Style Architecture: Clean, modular design inspired by Go's package structure
  • Data-Driven Validation: Comprehensive benchmarking to prove measurable performance gains

📦 Architecture

aethel-ts/
├── src/
│   ├── interfaces/          # Core interfaces (ICollection, IIterable)
│   ├── pkg/                 # Data structure packages (Go-style)
│   │   ├── list/           # List implementations
│   │   ├── queue/          # Queue implementations (planned)
│   │   ├── tree/           # Tree implementations (planned)
│   │   └── hash/           # Hash-based structures (planned)
│   ├── types.ts            # Utility types (Comparable, ComparatorFn, etc.)
│   └── index.ts            # Main export
├── benchmark/              # Performance benchmarks
└── dist/                   # Compiled output

🚀 Current Features

Doubly Linked List

  • O(1) Operations: addFirst, addLast, removeFirst, removeLast
  • Full Iterator Support: Works with for...of, map, filter, etc.
  • Type-Safe Generics: Compile-time type checking for all operations
  • Custom Equality: Support for custom equality comparators

LRU Cache (NEW! 🎉)

  • O(1) All Operations: get, put, delete - all constant time
  • Automatic Eviction: Least recently used items removed when capacity reached
  • Built-in Statistics: Hit rate, miss count, eviction tracking
  • Memory Safe: Explicit cleanup prevents memory leaks
  • Production Ready: Used in API caching, database query optimization, session management

🔧 Installation & Setup

# Install dependencies
npm install

# Run type checking
npm run type-check

# Build the library
npm run build

# Run benchmarks
npm run benchmark        # DoublyLinkedList benchmarks
npm run benchmark:cache  # LRUCache benchmarks
npm run benchmark:all    # All benchmarks

💡 Quick Start

DoublyLinkedList Example

import { DoublyLinkedList } from 'aethel-ts';

const list = new DoublyLinkedList<number>();

// O(1) operations
list.addLast(1);
list.addLast(2);
list.addFirst(0);  // [0, 1, 2]

list.removeFirst();  // [1, 2]
list.removeLast();   // [1]

// Iteration
for (const value of list) {
  console.log(value);
}

// Functional methods
const doubled = list.map(x => x * 2);
const filtered = list.filter(x => x > 0);

LRU Cache Example

import { LRUCache } from 'aethel-ts';

// API Response Caching
const cache = new LRUCache<string, any>(100);

async function fetchUser(id: string) {
  // Check cache first
  const cached = cache.get(id);
  if (cached) return cached;

  // Fetch from API
  const user = await fetch(`/api/users/${id}`).then(r => r.json());
  
  // Store in cache (automatic eviction when full)
  cache.put(id, user);
  
  return user;
}

// Monitor performance
console.log(cache.getStats());
// { hits: 45, misses: 5, hitRate: 0.9, evictions: 0 }

📊 Performance Benchmarks

DoublyLinkedList Results

Run npm run benchmark to see detailed comparisons.

Key Performance Wins:

  • Head insertion (addFirst): 21.6x faster than Array.unshift() (273,502 vs 12,638 ops/sec)
  • Head removal (removeFirst): 12.9x faster than Array.shift() (183,314 vs 14,180 ops/sec)
  • Tail operations: Competitive with Array (262,006 vs 226,033 ops/sec for insertion)

When to use DoublyLinkedList:

  • Queue implementations (FIFO)
  • Deque operations (both ends)
  • LRU Cache backing store
  • Frequent head/tail modifications

LRU Cache Results

Run npm run benchmark:cache to see detailed comparisons.

Key Performance Wins:

  • O(1) complexity for all operations (get, put, delete)
  • 10-100x faster than naive Map+Array implementations
  • Handles high contention (Zipf distribution) without degradation
  • Built-in statistics with negligible overhead

Real-world use cases:

  • API response caching (60-90% hit rates typical)
  • Database query result caching
  • Computed value memoization
  • Session management with automatic cleanup

🛠️ Technology Stack

  • TypeScript 5.3+: Advanced type system with strict mode
  • esbuild: High-speed bundler for development
  • Benchmark.js: Professional-grade performance testing
  • Node.js 18+: Modern runtime environment

📈 Development Roadmap

  • [x] Project initialization
  • [x] Core interfaces (ICollection, IIterable)
  • [x] Doubly Linked List implementation
  • [x] Benchmark infrastructure
  • [x] LRU Cache implementation
  • [x] Complex workload benchmarks
  • [x] Memory leak prevention
  • [ ] Optimized Queue (O(1) enqueue/dequeue)
  • [ ] Hash Set (O(1) average lookup)
  • [ ] Stack (type-safe wrapper)
  • [ ] Binary Search Tree
  • [ ] Red-Black Tree
  • [ ] Priority Queue (Heap)

🎓 Learning & Best Practices

This project demonstrates:

  • Advanced TypeScript patterns (conditional types, mapped types)
  • Performance-critical algorithm implementation
  • Proper use of Big-O notation in real-world scenarios
  • Scientific benchmarking methodology
  • Clean architecture principles

📝 License

MIT

🤝 Contributing

This is currently an educational/portfolio project. Feedback and suggestions are welcome!


Built with precision. Optimized for performance. Typed for safety.