Signals vs Observables
You'll learn: How signals differ from RxJS observables in their execution model, memory footprint, and developer experience.
While both signals and observables help manage reactive data flow, they take fundamentally different approaches to the same problem.
Push vs Pull
Observables are push-based: they actively push values to subscribers whenever new data arrives. Each subscription creates a separate execution context, potentially duplicating work if multiple subscribers exist.
Signals are pull-based: they hold a current value that consumers read on demand. Computed signals and effects automatically track dependencies and recalculate only when needed, but the consumer pulls the value when they need it.
Think of observables like a newsletter service sending emails to subscribers, while signals are like a bulletin board where people check for updates when they need them.
Memory Overhead
Observables carry significant overhead: each subscription creates closure chains, manages teardown logic, and maintains separate operator pipelines. With multiple subscribers, this multiplies.
Signals maintain a lightweight dependency graph. A signal stores its current value and a list of dependents. When the signal updates, it notifies dependents directly without creating new execution contexts. This makes signals more memory-efficient for fine-grained reactivity.
Programming Model
Observables use method chaining with operators like map, filter, and switchMap. You compose asynchronous streams declaratively but must manage subscriptions carefully to avoid leaks.
Signals use simple function calls: read a signal by calling it, create computed values with computed(), and trigger side effects with effect(). The system handles dependency tracking automatically—no manual subscription management required.
Observables excel at complex async operations (HTTP requests, timers, event streams), while signals shine for synchronous state management and UI updates.
Key Takeaway: Observables push values through subscription pipelines (great for async streams), while signals pull current values with automatic dependency tracking (ideal for synchronous reactive state with minimal overhead).