Get the latest tech news

Go Concurrency vs. RxJS


Pipelines vs RxJS How do they scale? Prerequisites: - You know RxJS - You know Go - You've used both - This is not a tutorial, don't copy code from here Basic Pipeline Go starts off with more boilerplate func Pipeline(in <-chan models.Product) <-chan models.Product { out := make(chan models.Product) go func() { for product := range in { out <- product } close(out) }() return out } export function pipeline(in$: Observable<Product>): Observable<Product> { return in$; } mergeMap The example is more comparable to concatMap, although there is no functional difference in this case. func Pipeline(in <-chan models.Product) <-chan string { out := make(chan string) go func() { for product := range in { for _, img := range product.Images { out <- img } } close(out) }() return out } export function pipeline(in$: Observable<Product>): Observable<string> { return in$.pipe( mergeMap(product => from(product.Images)), ); } Intertwined map & filter With rxjs, there are several ways of doing this.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of concurrency

concurrency

Photo of RxJS

RxJS

Related news:

News photo

Understanding Concurrency, Parallelism and JavaScript

News photo

Multitasking, parallel processing, and concurrency in Swift

News photo

What makes concurrency so hard?