Skip to main content

Arkhe vs Lodash: Which Utility Library for TypeScript?

Lodash has been the go-to JavaScript utility library for over a decade. It covers nearly every data manipulation need, from deep cloning to complex collection operations. But that breadth comes at a cost: large bundles, weak TypeScript inference, and legacy compatibility layers that modern projects don't need.

Arkhe is a modern alternative built from scratch in TypeScript. It targets ES2020+, ships as ES modules with granular entry points, and carries zero dependencies. This page compares both libraries across the dimensions that matter for production TypeScript projects.


At a Glance

AspectArkheLodash (lodash-es)
LanguageTypeScript-firstJavaScript with @types/lodash
TargetES2020+ES5 compatible
DependenciesZeroZero (but internal polyfills)
Tree-shakingPer-function entry pointsPartial (lodash-es)
Type inferenceStrict, narrow typesBroad, often any
Bundle per function~100-300 bytes gzipped~1-15 KB gzipped
API coverageCurated subset300+ functions

Bundle Size

This is where the difference is most visible. Lodash carries internal utilities and ES5 compatibility layers in every function. Arkhe ships standalone pure functions with no shared runtime.

For detailed per-function comparisons with real auto-generated data, see the Arkhe bundle size comparison.

Key takeaway: Arkhe functions are typically 10-50x smaller than their Lodash equivalents. Even compared to es-toolkit, Arkhe is generally 10-30% smaller on individual functions.

// Arkhe: only chunk ends up in your bundle (~150 bytes gzipped)
import { chunk } from "pithos/arkhe/array/chunk";

// Lodash-es: chunk + internal dependencies (~3 KB gzipped)
import { chunk } from "lodash-es";

Performance

Both libraries are fast enough for most applications. The differences show up in tight loops and large datasets.

For detailed benchmark results with auto-generated data, see the Arkhe performance benchmarks.

Key findings:

  • Arkhe and Lodash trade wins depending on the function and input size
  • Arkhe prioritizes correctness over raw speed: some functions do extra work (deduplication, input validation) that Lodash skips
  • On weighted real-world scoring, Arkhe is competitive across the board

Correctness Trade-offs

When Arkhe is slower, it's usually because it does more work to return correct results:

FunctionWhat Arkhe does extraWhy it matters
intersectionWithDeduplicates the resultA set intersection should not contain duplicates

A faster function that returns wrong results is not faster - it's incomplete.


Type Safety

Lodash was written in JavaScript. TypeScript support comes from @types/lodash, maintained separately. This creates gaps:

const obj = { a: { b: { c: 42 } } };

// Lodash: type inference is broad
import { get } from "lodash-es";
const value = get(obj, "a.b.c"); // any

// Arkhe: type inference is precise
import { get } from "pithos/arkhe/object/get";
const value = get(obj, ["a", "b", "c"]); // correctly typed

Arkhe functions use TypeScript generics and conditional types to infer return types as narrowly as possible. No any leaks, no manual type assertions needed.


Tree-Shaking

Lodash's original CommonJS build (lodash) doesn't tree-shake at all. lodash-es improves this, but functions still share internal utilities that bundlers can't always eliminate.

Arkhe uses per-function entry points. Each import resolves to a standalone module with no shared runtime:

// Each import is fully independent
import { chunk } from "pithos/arkhe/array/chunk";
import { groupBy } from "pithos/arkhe/array/groupBy";
import { get } from "pithos/arkhe/object/get";

This means your bundle contains exactly the code you use, nothing more.


Migration Guide

Ready to migrate? The complete step-by-step migration guide is in the Arkhe module documentation: install, replace imports incrementally, and check the equivalence table. Go to migration guide →

Not sure which library fits your use case? See the comparison overview.


Further Reading