languages

languages

143 bookmarks
Newest
Processing Arrays non-destructively: `for-of` vs. `.reduce()` vs. `.flatMap()`
Processing Arrays non-destructively: `for-of` vs. `.reduce()` vs. `.flatMap()`
In this blog post, we look at three ways of processing Arrays: The for-of loop The Array method .reduce() The Array method .flatMap() The goal is to help you choose between these features whenever you need to process Arrays. In case you don’t know .reduce() and .flatMap() yet, they will both be explained to you. In order to get a better feeling for how these three features work, we use each of them to implement the following functionality: Filtering an input Array to produce an output Array Mapping each input Array element to one output Array element Expanding each input Array element to zero or more output Array elements Filter-mapping (filtering and mapping in one step) Computing a summary for an Array Finding an Array element Checking a condition for all Array elements Everything we do is non-destructive: The input Array is never changed. If the output is an Array, it is always freshly created.
·2ality.com·
Processing Arrays non-destructively: `for-of` vs. `.reduce()` vs. `.flatMap()`
Analyzing Go Build Times
Analyzing Go Build Times
Go is often praised for its fast build times. While they are pretty quick, they are slow enough that I spend a lot of time waiting for them, enough that it prompted me to go down the rabbit hole of thoroughly analyzing them. This post covers all aspects of what makes Go builds fast or slow. Throughout this blog, we will use Istio as an example of real-world codebase. For reference on its size:
·blog.howardjohn.info·
Analyzing Go Build Times
A Deep Look Into Golang Profile-Guided Optimization (PGO)
A Deep Look Into Golang Profile-Guided Optimization (PGO)
Intro Profile-Guided Optimization (PGO) is an optimization method which improves final compiled binary by using profile data hints and compiling the code based on those profiles. There are several optimization mechanisms that compilers usually get into account when compiling your code to binary. Like dead code elimination, Register allocation, Constant folding or function inlining; you may split your code into smaller and smaller functions and different level of abstractions to ease up future changes and modifications, but from compiler point of view multiple calls to different functions may not be very optimize and sometimes compiler decides to inline your functions!
·theyahya.com·
A Deep Look Into Golang Profile-Guided Optimization (PGO)