# array

Published articles for array.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## How fast is C++23's std::flat\_map?

DevFeed: [How fast is C++23's std::flat\_map?](<https://devfeed.tech/articles/how-fast-is-c-23-s-std-flat-map-31465.md>)

Original publisher: [Read original article](<https://lemire.me/blog/2026/09/16/how-fast-is-c23s-stdflat_map/>)

Author: Daniel Lemire

Published: 2026-09-16T20:26:36Z

Content type: article

Language: en

Sources: [Daniel Lemire](<https://devfeed.tech/sources/daniel-lemire.md>)

Topics: [Data structures](<https://devfeed.tech/topics/data-structures.md>), [Library](<https://devfeed.tech/topics/library.md>), [gcc](<https://devfeed.tech/topics/gcc.md>), [LLVM](<https://devfeed.tech/topics/llvm.md>), [clang](<https://devfeed.tech/topics/clang.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [arrays](<https://devfeed.tech/tags/arrays.md>), [clang](<https://devfeed.tech/tags/clang.md>), [gcc](<https://devfeed.tech/tags/gcc.md>), [llvm](<https://devfeed.tech/tags/llvm.md>), [overhead](<https://devfeed.tech/tags/overhead.md>), [speed](<https://devfeed.tech/tags/speed.md>), [standard-library](<https://devfeed.tech/tags/standard-library.md>)

### AI overview

This article benchmarks C++23's std::flat_map, a sorted container backed by parallel arrays of keys and values. It explains serialization and loading considerations, then compares insertion and lookup performance with std::map. Random-order insertion becomes quadratic as the container grows, while increasing-order or bulk insertion is much faster; random lookups can also be faster for large maps because std::flat_map uses less memory.

### Source excerpt

C++23 added a new type to the standard library: std::flat_map. There is also a std::flat_set and other variants, but let me focus on std::flat_map. A flat map is a sorted vector of keys next to a vector of values. A query is a binary search over the sorted keys. You need a recent standard library: ... Continue reading How fast is C++23's std::flat_map?

## Let's Reduce! A Gentle Introduction to Javascript's Reduce Method

DevFeed: [Let's Reduce! A Gentle Introduction to Javascript's Reduce Method](<https://devfeed.tech/articles/let-s-reduce-a-gentle-introduction-to-javascript-s-reduce-method-27391.md>)

Original publisher: [Read original article](<http://engineering.khanacademy.org/posts/lets-reduce.htm>)

Author: Khan Academy

Published: 2017-07-10T22:00:00Z

Content type: tutorial

Language: en

Sources: [Khan Academy](<https://devfeed.tech/sources/khan-academy.md>)

Topics: [JavaScript](<https://devfeed.tech/topics/javascript.md>), [coding](<https://devfeed.tech/topics/coding.md>), [Redux](<https://devfeed.tech/topics/redux.md>), [Web Development](<https://devfeed.tech/topics/web-development.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [arrow](<https://devfeed.tech/tags/arrow.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [filter](<https://devfeed.tech/tags/filter.md>), [introduction](<https://devfeed.tech/tags/introduction.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [map](<https://devfeed.tech/tags/map.md>), [news](<https://devfeed.tech/tags/news.md>), [react](<https://devfeed.tech/tags/react.md>), [reduce](<https://devfeed.tech/tags/reduce.md>), [web-frontend](<https://devfeed.tech/tags/web-frontend.md>)

### AI overview

A tutorial explaining JavaScript's reduce method as a foundation for understanding Redux. It describes how reduce processes array items, how each iteration depends on the previous return value, and why the method can be difficult to learn.

### Source excerpt

By Josh Comeau Every summer, Khan Academy recruits a few software engineer interns. As part of their onboarding, ... Read more

## Python sets and dictionaries can have quadratic-time performance

DevFeed: [Python sets and dictionaries can have quadratic-time performance](<https://devfeed.tech/articles/python-sets-and-dictionaries-can-have-quadratic-time-performance-29426.md>)

Original publisher: [Read original article](<https://lemire.me/blog/2026/09/03/python-sets-and-dictionaries-can-have-quadratic-time-performance/>)

Author: Daniel Lemire

Published: 2026-09-03T14:01:45Z

Content type: article

Language: en

Sources: [Daniel Lemire](<https://devfeed.tech/sources/daniel-lemire.md>)

Topics: [Python](<https://devfeed.tech/topics/python.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>), [hash](<https://devfeed.tech/topics/hash.md>), [CPU Cache](<https://devfeed.tech/topics/cpu-cache.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [cpu-cache](<https://devfeed.tech/tags/cpu-cache.md>), [data-structure](<https://devfeed.tech/tags/data-structure.md>), [hash](<https://devfeed.tech/tags/hash.md>), [performance](<https://devfeed.tech/tags/performance.md>), [python](<https://devfeed.tech/tags/python.md>)

### AI overview

The article explains why Python sets and dictionaries are not formally constant-time in all cases. Hash collisions can make insertions and membership checks take quadratic time, while growing data structures can also incur reallocation and slower memory access as they exceed CPU cache capacity.

### Source excerpt

In Python, the dict data structure is the conventional key-value structure. E.g., you might store a list of names as keys and have their phone numbers as values. Valentin Ignatev wrote this amusing post on X: It is indeed widely believed that, in the strict sense, the dict data structure and its companion, the set ... Continue reading Python sets and dictionaries can have quadratic-time performance

## CodeSOD: The Big Family

DevFeed: [CodeSOD: The Big Family](<https://devfeed.tech/articles/codesod-the-big-family-28514.md>)

Original publisher: [Read original article](<https://thedailywtf.com/articles/the-big-family>)

Author: Remy Porter

Published: 2026-08-27T06:30:00Z

Content type: opinion

Language: en

Sources: [The Daily WTF](<https://devfeed.tech/sources/the-daily-wtf.md>)

Topics: [PHP](<https://devfeed.tech/topics/php.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Code](<https://devfeed.tech/topics/code.md>), [data](<https://devfeed.tech/topics/data.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [Localization (l10n)](<https://devfeed.tech/topics/localization.md>), [formatting](<https://devfeed.tech/topics/formatting.md>), [HTML](<https://devfeed.tech/topics/html.md>), [Parsing](<https://devfeed.tech/topics/parsing.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [code](<https://devfeed.tech/tags/code.md>), [codesod](<https://devfeed.tech/tags/codesod.md>), [fetch](<https://devfeed.tech/tags/fetch.md>), [formatting](<https://devfeed.tech/tags/formatting.md>), [html](<https://devfeed.tech/tags/html.md>), [humor](<https://devfeed.tech/tags/humor.md>), [php](<https://devfeed.tech/tags/php.md>), [programming](<https://devfeed.tech/tags/programming.md>), [sql](<https://devfeed.tech/tags/sql.md>)

### AI overview

This commentary examines a large, generalized PHP code sample that builds hierarchical output from a presumed database source. It highlights probable SQL injection risk, unused array keys, dynamic localization fields, extensive number formatting and HTML string manipulation, string-based date-time parsing, and repeated code for child and sibling records.

### Source excerpt

Some time ago, Charles shared with us some awful PHP, aka the most common sort. Today's code sample is maybe a little too big to sum up, but I'll let Charles take a crack at it. It's so bad that even analyzing and laughing at it feels impossible. But it's so bad, I couldn't not share it. I'm the only one handling all the IT-related tasks at my company, and I don't have anyone here to vent or laugh about this kind of thing with. So, I figured, why not share it here? I'm hoping it'll provide at least a little bit of catharsis or some dark humor. To make sure the confidentiality of the codebase was respected, I took the liberty of generalizing it. You might notice some inconsistencies, but that's just me trying to keep things neutral while protecting the original structure and functionality. Apologies if it looks a bit patchy - the goal was to avoid revealing any specific details or sensitive code. The whole block is north of 400 lines, and it's doing a lot. Or well, maybe it's not, as you'll see. Let's star with the outermost layer. $resm_data = $data_source->fetchData("group=" . $item_id); foreach ($resm_data as $key => $value) { // rest of the code here } We fetch data from a data source, presumably a database, passing our condition as a string, which reeks of probable SQL injection, but I don't know what library they're using. I also note they're using the key/value style of array iteration, but never actually check the key. $option_id = $value->option_id; $resm_details = $detail_source->fetch($option_id); if ($resm_details) { $label = $resm_details->{"label$lang"}; $description = $resm_details->{"description$lang"}; $category = $resm_details->category; Nice little bit of "meta" programming to get their localization working, it'll fetch labelen or labelde as needed. Definitely not a horrible, dangerous way to solve that problem. We use that again to get our currency figured out. That lets us do number formatting. So much number formatting code. if ($category == 0)

## 【eBPF 内核实现深度拆解】从验证器到 JIT，从 BTF 到调度器

DevFeed: [【eBPF 内核实现深度拆解】从验证器到 JIT，从 BTF 到调度器](<https://devfeed.tech/articles/ebpf-jit-btf-33982.md>)

Original publisher: [Read original article](<https://quant67.com/post/ebpf/index.html>)

Author: Liao Tonglang

Published: 2026-06-12T00:00:00Z

Content type: article

Language: zh

Sources: [土法炼钢 - 系统与基础设施](<https://devfeed.tech/sources/source-4.md>)

Topics: [eBPF](<https://devfeed.tech/topics/ebpf.md>), [Linux](<https://devfeed.tech/topics/linux.md>), [JIT](<https://devfeed.tech/topics/jit.md>), [Benchmark](<https://devfeed.tech/topics/benchmark.md>), [clang](<https://devfeed.tech/topics/clang.md>), [hash](<https://devfeed.tech/topics/hash.md>), [benchmarking](<https://devfeed.tech/topics/benchmarking.md>), [RISC-V](<https://devfeed.tech/topics/riscv.md>), [ast-matchers](<https://devfeed.tech/topics/ast-matchers.md>)

Tags: [arm](<https://devfeed.tech/tags/arm.md>), [array](<https://devfeed.tech/tags/array.md>), [benchmark](<https://devfeed.tech/tags/benchmark.md>), [bpf-jit](<https://devfeed.tech/tags/bpf-jit.md>), [bpf-maps](<https://devfeed.tech/tags/bpf-maps.md>), [bpf-verifier](<https://devfeed.tech/tags/bpf-verifier.md>), [btf](<https://devfeed.tech/tags/btf.md>), [clang](<https://devfeed.tech/tags/clang.md>), [co-re](<https://devfeed.tech/tags/co-re.md>), [cpu](<https://devfeed.tech/tags/cpu.md>), [ebpf](<https://devfeed.tech/tags/ebpf.md>), [fentry](<https://devfeed.tech/tags/fentry.md>), [hash](<https://devfeed.tech/tags/hash.md>), [jit](<https://devfeed.tech/tags/jit.md>), [kernel](<https://devfeed.tech/tags/kernel.md>), [libbpf](<https://devfeed.tech/tags/libbpf.md>), [linux](<https://devfeed.tech/tags/linux.md>), [linux-kernel](<https://devfeed.tech/tags/linux-kernel.md>), [precision](<https://devfeed.tech/tags/precision.md>), [risc-v](<https://devfeed.tech/tags/risc-v.md>), [sched-ext](<https://devfeed.tech/tags/sched-ext.md>), [trampoline](<https://devfeed.tech/tags/trampoline.md>), [x86](<https://devfeed.tech/tags/x86.md>), [xdp](<https://devfeed.tech/tags/xdp.md>)

### AI overview

This Chinese-language series systematically explains eBPF's Linux kernel implementation, covering the BPF instruction set and registers, verifier algorithms, JIT compilation, map data structures and concurrency, helper type checking, BTF and CO-RE relocation, libbpf loading, trampolines, and sched_ext interfaces. It is aimed at engineers who want to understand eBPF kernel source code and build production BPF programs.

### Source excerpt

eBPF 内核虚拟机内部实现系统讲解：BPF 指令集与寄存器机器、验证器的抽象解释与状态裁剪、JIT 编译器后端、Map 各类型的并发与内存模型、helper 函数注册与类型检查、BTF 格式规范与 CO-RE 重定位引擎、libbpf 加载器工程、fentry/fexit 蹦床机制、sched_ext 调度器内核接口。面向想读懂 eBPF 内核源码、写生产级 BPF 程序的系统工程师。

## A SIMD quaternary search algorithm for sorted arrays of 16-bit integers

DevFeed: [A SIMD quaternary search algorithm for sorted arrays of 16-bit integers](<https://devfeed.tech/articles/you-can-beat-the-binary-search-29402.md>)

Original publisher: [Read original article](<https://lemire.me/blog/2026/04/27/you-can-beat-the-binary-search/>)

Author: Daniel Lemire

Published: 2026-04-27T17:32:13Z

Content type: tutorial

Language: en

Sources: [Daniel Lemire](<https://devfeed.tech/sources/daniel-lemire.md>)

Topics: [Algorithms](<https://devfeed.tech/topics/algorithms.md>), [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>)

Tags: [algorithm](<https://devfeed.tech/tags/algorithm.md>), [array](<https://devfeed.tech/tags/array.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>)

### AI overview

The article explains linear and binary search for sorted arrays, then introduces the SIMD Quad algorithm. The algorithm combines quaternary interpolation search with SIMD instructions to search sorted arrays of 16-bit unsigned integers in fixed-size blocks.

### Source excerpt

We sometimes have to look for a value in a sorted array. The simplest algorithm consists in just going through the values one by one, until we encounter the value, or exhaust the array. We sometimes call this algorithm a linear search. In C++, you can get the desired effect with the std::find function. For ... Continue reading You can beat the binary search

## Changing Immutable Collections

DevFeed: [Changing Immutable Collections](<https://devfeed.tech/articles/changing-immutable-collections-30704.md>)

Original publisher: [Read original article](<https://codeblog.jonskeet.uk/2025/12/31/changing-immutable-collections/>)

Author: jonskeet

Published: 2025-12-31T10:32:45Z

Content type: article

Language: en

Sources: [Jon Skeet](<https://devfeed.tech/sources/jon-skeet.md>)

Topics: [C#](<https://devfeed.tech/topics/csharp.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [arrays](<https://devfeed.tech/tags/arrays.md>), [blog](<https://devfeed.tech/tags/blog.md>), [blog-post](<https://devfeed.tech/tags/blog-post.md>), [c-sharp](<https://devfeed.tech/tags/c-sharp.md>), [collection](<https://devfeed.tech/tags/collection.md>), [election-2029](<https://devfeed.tech/tags/election-2029.md>), [immutability](<https://devfeed.tech/tags/immutability.md>), [linq](<https://devfeed.tech/tags/linq.md>), [migration](<https://devfeed.tech/tags/migration.md>), [properties](<https://devfeed.tech/tags/properties.md>)

### AI overview

The article explains a migration from ImmutableList<T> and ImmutableDictionary<TKey, TValue> to immutable collection types better suited to code that creates collections and then leaves them unchanged. It describes the migration steps and related helper-method and property-type changes.

### Source excerpt

As I've written before, I'm leaning heavily into immutability in the election site code. Until September 2025 (it's taken a long time to get round to writing this blog post) that meant a combination of records, ImmutableList<T> and ImmutableDictionary<TKey, TValue>. In an ECMA C# standards meeting, however, Joseph Musser passed on some really valuable feedback ... Continue reading Changing Immutable Collections ->

## p-fast trie: lexically ordered hash map

DevFeed: [p-fast trie: lexically ordered hash map](<https://devfeed.tech/articles/p-fast-trie-lexically-ordered-hash-map-36219.md>)

Original publisher: [Read original article](<https://dotat.at/@/2025-08-04-p-fast-trie.html>)

Published: 2025-08-04T20:52:21Z

Content type: article

Language: en

Sources: [Tony Finch's blog](<https://devfeed.tech/sources/tony-finch-s-blog.md>)

Topics: [hash](<https://devfeed.tech/topics/hash.md>), [Query (disambiguation)](<https://devfeed.tech/topics/query.md>), [Rust](<https://devfeed.tech/topics/rust.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [bits](<https://devfeed.tech/tags/bits.md>), [hash](<https://devfeed.tech/tags/hash.md>), [map](<https://devfeed.tech/tags/map.md>), [maps](<https://devfeed.tech/tags/maps.md>), [query](<https://devfeed.tech/tags/query.md>)

### AI overview

This article sketches the p-fast trie, a proposed lexically ordered hash map that replaces a qp-trie's tree and interior pointers with stratified hash-map levels keyed by prefixes. It describes O(1) exact-match lookups and O(log k) predecessor and successor searches, while noting that the practical benefit is uncertain.

### Source excerpt

Here's a sketch of an idea that might or might not be a good idea. Dunno if it's similar to something already described in the literature - if you know of something, please let me know via the links in the footer! The gist is to throw away the tree and interior pointers from a qp-trie. Instead, the p-fast trie is stored using a hash map organized into stratified levels, where each level corresponds to a prefix of the key. Exact-match lookups are normal O(1) hash map lookups. Predecessor / successor searches use binary chop on the length of the key. Where a qp-trie search is O(k), where k is the length of the key, a p-fast trie search is O(log k). This smaller O(log k) bound is why I call it a "p-fast trie" by analogy with the x-fast trie, which has O(log log N) query time. (The "p" is for popcount.) I'm not sure if this asymptotic improvement is likely to be effective in practice; see my thoughts towards the end of this note. layout A p-fast trie consists of: Leaf objects, each of which has a name. Each leaf object refers to its successor forming a circular linked list. (The last leaf refers to the first.) Multiple interior nodes refer to each leaf object. A hash map containing every (strict) prefix of every name in the trie. Each prefix maps to a unique interior node. Names are treated as bit strings split into chunks of (say) 6 bits, and prefixes are whole numbers of chunks. An interior node contains a (1<<6) == 64 wide bitmap with a bit set for each chunk where prefix+chunk matches a key. Following the bitmap is a popcount-compressed array of references to the leaf objects that are the closest predecessor of the corresponding prefix+chunk key. Prefixes are strictly shorter than names so that we can avoid having to represent non-values after the end of a name, and so that it's OK if one name is a prefix of another. The size of chunks and bitmaps might change; 6 is a guess that I expect will work OK. For restricted alphabets you can use something like my DNS trie n

## Rust HashMap notes

DevFeed: [Rust HashMap notes](<https://devfeed.tech/articles/rust-hashmap-notes-35458.md>)

Original publisher: [Read original article](<https://darkcoding.net/software/rust-hashmap-notes/>)

Author: Graham King

Published: 2025-03-30T14:50:00Z

Content type: article

Language: en

Sources: [Graham King](<https://devfeed.tech/sources/graham-king.md>)

Topics: [Rust](<https://devfeed.tech/topics/rust.md>), [implementation](<https://devfeed.tech/topics/implementation.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [bits](<https://devfeed.tech/tags/bits.md>), [cache](<https://devfeed.tech/tags/cache.md>), [code](<https://devfeed.tech/tags/code.md>), [datastructures](<https://devfeed.tech/tags/datastructures.md>), [hash](<https://devfeed.tech/tags/hash.md>), [hashmap](<https://devfeed.tech/tags/hashmap.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [rust](<https://devfeed.tech/tags/rust.md>), [software](<https://devfeed.tech/tags/software.md>)

### AI overview

Raw research notes explaining the design and implementation of Rust's HashMap. The article describes its SwissTable-based probing layout, contiguous storage, control bytes, SIMD comparisons, hash decomposition, lookup process, and growth behavior.

### Source excerpt

Raw notes on Rust's HashMap design and implementation

## CPU Performance Optimization notes

DevFeed: [CPU Performance Optimization notes](<https://devfeed.tech/articles/cpu-performance-optimization-notes-35385.md>)

Original publisher: [Read original article](<https://darkcoding.net/software/cpu-optimization-notes/>)

Author: Graham King

Published: 2025-03-29T16:15:00Z

Content type: tutorial

Language: en

Sources: [Graham King](<https://devfeed.tech/sources/graham-king.md>)

Topics: [cpu](<https://devfeed.tech/topics/cpu.md>), [Optimization](<https://devfeed.tech/topics/optimization.md>), [performance-optimization](<https://devfeed.tech/topics/performance-optimization.md>), [Cache](<https://devfeed.tech/topics/cache.md>), [Code](<https://devfeed.tech/topics/code.md>), [data](<https://devfeed.tech/topics/data.md>), [floating-point](<https://devfeed.tech/topics/floating-point.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [arrays](<https://devfeed.tech/tags/arrays.md>), [cache](<https://devfeed.tech/tags/cache.md>), [code](<https://devfeed.tech/tags/code.md>), [cpu](<https://devfeed.tech/tags/cpu.md>), [cpu-optimization](<https://devfeed.tech/tags/cpu-optimization.md>), [data](<https://devfeed.tech/tags/data.md>), [floating-point](<https://devfeed.tech/tags/floating-point.md>), [hardware](<https://devfeed.tech/tags/hardware.md>), [loops](<https://devfeed.tech/tags/loops.md>), [memory](<https://devfeed.tech/tags/memory.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [performance](<https://devfeed.tech/tags/performance.md>), [performance-optimization](<https://devfeed.tech/tags/performance-optimization.md>), [software](<https://devfeed.tech/tags/software.md>)

### AI overview

Raw notes on CPU performance optimization covering data locality, cache behavior, memory alignment, data layout, prefetching, integer and floating-point types, powers of two, vectorization, and predictable branching.

### Source excerpt

Raw notes on CPU optimization

## When SQL Meets Lambda Expressions

DevFeed: [When SQL Meets Lambda Expressions](<https://devfeed.tech/articles/when-sql-meets-lambda-expressions-28971.md>)

Original publisher: [Read original article](<https://blog.jooq.org/when-sql-meets-lambda-expressions/>)

Author: lukaseder

Published: 2025-03-27T13:04:44Z

Content type: tutorial

Language: en

Sources: [jOOQ](<https://devfeed.tech/sources/jooq.md>)

Topics: [SQL](<https://devfeed.tech/topics/sql.md>), [Structured-data](<https://devfeed.tech/topics/structured-data.md>), [DuckDB](<https://devfeed.tech/topics/duckdb.md>), [clickhouse](<https://devfeed.tech/topics/clickhouse.md>), [databricks](<https://devfeed.tech/topics/databricks.md>), [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>)

Tags: [apply](<https://devfeed.tech/tags/apply.md>), [array](<https://devfeed.tech/tags/array.md>), [array-types](<https://devfeed.tech/tags/array-types.md>), [arrays](<https://devfeed.tech/tags/arrays.md>), [clickhouse](<https://devfeed.tech/tags/clickhouse.md>), [concatenation](<https://devfeed.tech/tags/concatenation.md>), [databricks](<https://devfeed.tech/tags/databricks.md>), [duckdb](<https://devfeed.tech/tags/duckdb.md>), [filter](<https://devfeed.tech/tags/filter.md>), [function](<https://devfeed.tech/tags/function.md>), [java](<https://devfeed.tech/tags/java.md>), [jooq](<https://devfeed.tech/tags/jooq.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [lambda](<https://devfeed.tech/tags/lambda.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [scala](<https://devfeed.tech/tags/scala.md>), [snowflake](<https://devfeed.tech/tags/snowflake.md>), [sql](<https://devfeed.tech/tags/sql.md>), [trino](<https://devfeed.tech/tags/trino.md>)

### AI overview

This article explains how SQL ARRAY types and lambda expressions are supported across several modern SQL dialects. It shows how jOOQ maps Java, Kotlin, and Scala lambda expressions to SQL expressions, including filtering arrays, and describes emulation with subqueries for dialects without lambda syntax.

### Source excerpt

ARRAY types are a part of the ISO/IEC 9075 SQL standard. The standard specifies how to: But it is very unopinionated when it comes to function support. The ISO/IEC 9075-2:2023(E) 6.47 <array value expression> specifies concatenation of arrays, whereas the 6.48 <array value function> section lists a not extremely useful TRIM_ARRAY function, exclusively (using which ... Continue reading When SQL Meets Lambda Expressions ->

## jOOQ 3.20 released with ClickHouse, Databricks, and much more DuckDB support, new modules, Oracle type hierarchies, more spatial support, decfloat and synonym support, hidden columns, Scala 3, Kotlin 2, and much more

DevFeed: [jOOQ 3.20 released with ClickHouse, Databricks, and much more DuckDB support, new modules, Oracle type hierarchies, more spatial support, decfloat and synonym support, hidden columns, Scala 3, Kotlin 2, and much more](<https://devfeed.tech/articles/jooq-3-20-released-with-clickhouse-databricks-and-much-more-duckdb-support-new-modules-oracle-type-hierarchies-more-spatial-support-decfloat-and-synonym-support-hidden-co-28953.md>)

Original publisher: [Read original article](<https://blog.jooq.org/jooq-3-20-released-with-clickhouse-databricks-and-much-more-duckdb-support-new-modules-oracle-type-hierarchies-more-spatial-support-decfloat-and-synonym-support-hidden-columns-scala-3-kotlin/>)

Author: lukaseder

Published: 2025-02-20T10:27:54Z

Content type: release

Language: en

Sources: [jOOQ](<https://devfeed.tech/sources/jooq.md>)

Topics: [clickhouse](<https://devfeed.tech/topics/clickhouse.md>), [databricks](<https://devfeed.tech/topics/databricks.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [DuckDB](<https://devfeed.tech/topics/duckdb.md>), [modules](<https://devfeed.tech/topics/modules.md>), [Oracle Database](<https://devfeed.tech/topics/oracle-database.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Scala](<https://devfeed.tech/topics/scala.md>), [reactive](<https://devfeed.tech/topics/reactive.md>), [jpa](<https://devfeed.tech/topics/jpa.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [clickhouse](<https://devfeed.tech/tags/clickhouse.md>), [databricks](<https://devfeed.tech/tags/databricks.md>), [decfloat](<https://devfeed.tech/tags/decfloat.md>), [dirty-tracking](<https://devfeed.tech/tags/dirty-tracking.md>), [dml-join](<https://devfeed.tech/tags/dml-join.md>), [duckdb](<https://devfeed.tech/tags/duckdb.md>), [hidden-columns](<https://devfeed.tech/tags/hidden-columns.md>), [jdk-21](<https://devfeed.tech/tags/jdk-21.md>), [jooq](<https://devfeed.tech/tags/jooq.md>), [jooq-3-20](<https://devfeed.tech/tags/jooq-3-20.md>), [jooq-development](<https://devfeed.tech/tags/jooq-development.md>), [jpa](<https://devfeed.tech/tags/jpa.md>), [json](<https://devfeed.tech/tags/json.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-2](<https://devfeed.tech/tags/kotlin-2.md>), [merge](<https://devfeed.tech/tags/merge.md>), [modules](<https://devfeed.tech/tags/modules.md>), [oracle](<https://devfeed.tech/tags/oracle.md>), [oracle-plsql-types](<https://devfeed.tech/tags/oracle-plsql-types.md>), [r2dbc](<https://devfeed.tech/tags/r2dbc.md>), [reactive](<https://devfeed.tech/tags/reactive.md>), [scala](<https://devfeed.tech/tags/scala.md>), [scala-3](<https://devfeed.tech/tags/scala-3.md>), [sequences](<https://devfeed.tech/tags/sequences.md>), [spatial](<https://devfeed.tech/tags/spatial.md>), [sql](<https://devfeed.tech/tags/sql.md>)

### AI overview

jOOQ 3.20 introduces experimental ClickHouse and Databricks SQL dialects, improves DuckDB support, adds new integration modules, and expands support for Oracle type hierarchies, spatial features, decfloat, synonyms, hidden columns, Scala 3, and Kotlin 2.

### Source excerpt

New dialects: jOOQ 3.20 ships with 2 new experimental dialects: ClickHouse is a fast-moving SQL dialect with a historic vendor-specific syntax that is gradually migrated to a more standards compliant alternative, which is why our support is still experimental. A lot of behaviours differ from what one would expect elsewhere, including NULL handling, which is ... Continue reading jOOQ 3.20 released with ClickHouse, Databricks, and much more DuckDB support, new modules, Oracle type hierarchies, more spatial support, decfloat and synonym support, hidden columns, Scala 3, Kotlin 2, and much more ->

## Using Different Size Pools in Ruby Garbage Collection

DevFeed: [Using Different Size Pools in Ruby Garbage Collection](<https://devfeed.tech/articles/using-different-size-pools-31810.md>)

Original publisher: [Read original article](<https://patshaughnessy.net/2025/2/11/using-different-size-pools>)

Author: Pat Shaughnessy

Published: 2025-02-11T00:00:00Z

Content type: tutorial

Language: en

Sources: [Pat Shaughnessy](<https://devfeed.tech/sources/pat-shaughnessy.md>)

Topics: [Ruby](<https://devfeed.tech/topics/ruby.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [gc](<https://devfeed.tech/tags/gc.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [updating-ruby-under-a-microscope](<https://devfeed.tech/tags/updating-ruby-under-a-microscope.md>)

### AI overview

An excerpt from an updated Ruby garbage-collection chapter explains how to use GC.stat_heap in Ruby 3.2 and later to inspect size-pool statistics while allocating arrays of different capacities.

### Source excerpt

I've started working on a new edition of Ruby Under a Microscope that covers Ruby 3.x. I'm working on this in my spare time, so it will take a while. Leave a comment or drop me a line and I'll email you when it's finished. The Ruby team has done

## Intuitive Proofs for Linked-List Loop Detection and Majority-Element Algorithms

DevFeed: [Intuitive Proofs for Linked-List Loop Detection and Majority-Element Algorithms](<https://devfeed.tech/articles/relatively-non-obvious-tricks-in-solving-simple-algorithmic-problems-38655.md>)

Original publisher: [Read original article](<https://krossovochkin.com/posts/2024_12_21_relatively_non_obvious_tricks_in_solving_simple_algorithmic_problems/>)

Published: 2024-12-21T00:00:00Z

Content type: tutorial

Language: en

Sources: [Vasya Drobushkov](<https://devfeed.tech/sources/vasya-drobushkov.md>)

Topics: [Algorithms, Complexity](<https://devfeed.tech/topics/algorithms-complexity.md>), [Algorithms](<https://devfeed.tech/topics/algorithms.md>), [LeetCode](<https://devfeed.tech/topics/leetcode.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [algorithms](<https://devfeed.tech/tags/algorithms.md>), [array](<https://devfeed.tech/tags/array.md>), [code](<https://devfeed.tech/tags/code.md>), [collections](<https://devfeed.tech/tags/collections.md>), [counter](<https://devfeed.tech/tags/counter.md>), [examples](<https://devfeed.tech/tags/examples.md>), [memory](<https://devfeed.tech/tags/memory.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [solutions](<https://devfeed.tech/tags/solutions.md>), [time](<https://devfeed.tech/tags/time.md>)

### AI overview

This tutorial explains why concise solutions to seemingly easy algorithmic problems work. It uses linked-list loop detection with slow and fast pointers and majority-element detection with a counter, emphasizing intuitive proofs over implementation alone.

### Source excerpt

Blowing the dust off LeetCode once again, I found myself, as in the past, struggling with coding relatively simple algorithms. Just like with anything else, if you don't practice for years, you lose some of the hands-on experience. On the positive side, I noticed that for some problems, my new submissions were much better and more concise compared to my old ones. That's an awesome feeling--a tangible measure of growth. While tackling certain easy problems, I realized that "easy" usually just means "doesn't require much code." However, the idea behind the optimal solution might still not be very intuitive. Sure, one can use brute force or additional collections, but in most cases, this leads to either a "time limit exceeded" or an "out of memory" error.

## Eliminating Intermediate Array Allocations

DevFeed: [Eliminating Intermediate Array Allocations](<https://devfeed.tech/articles/eliminating-intermediate-array-allocations-38999.md>)

Original publisher: [Read original article](<https://tenderlovemaking.com/2024/09/29/eliminating-intermediate-array-allocations/>)

Published: 2024-09-30T02:06:28Z

Content type: tutorial

Language: en

Sources: [Aaron Patterson](<https://devfeed.tech/sources/aaron-patterson.md>)

Topics: [Ruby](<https://devfeed.tech/topics/ruby.md>), [Code](<https://devfeed.tech/topics/code.md>), [tagged pointers](<https://devfeed.tech/topics/tagged-pointers.md>), [math](<https://devfeed.tech/topics/math.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [code](<https://devfeed.tech/tags/code.md>), [function](<https://devfeed.tech/tags/function.md>), [gc](<https://devfeed.tech/tags/gc.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [tagged-pointers](<https://devfeed.tech/tags/tagged-pointers.md>)

### AI overview

This Ruby article explains how to measure object allocations with GC.stat and distinguishes code that never, sometimes, or always allocates. It focuses on why an intermediate array used in certain min or max calculations can be allocated on the stack and discarded without requesting a new object from the garbage collector.

### Source excerpt

Recently I gave a talk at RailsWorld (hopefully they'll post the video soon), and part of my presentation was about eliminating allocations in tokenizers. I presented a simple function for measuring allocations: def allocations x = GC.stat(:total_allocated_objects) yield GC.stat(:total_allocated_objects) - x end Everything in Ruby is an object, but not all objects actually make allocations. We can use the above function to measure allocations made in a block. Here are some examples of code that never allocate: p allocations { true } # => 0 p allocations { false } # => 0 p allocations { nil } # => 0 p allocations { :hello } # => 0 p allocations { 1 } # => 0 p allocations { 2.3 } # => 0 p allocations { 0xFFFF_FFFF_FFFF_FFFF } # => 0 Literals like booleans, nil, symbols, integers, and floats are represented internally to CRuby as "tagged pointers" and they don't allocate anything when executed. Here is an example of code that sometimes allocates: # Depends on the size of the number p allocations { 1 + 2 } # => 0 p allocations { 0x3FFF_FFFF_FFFF_FFFF + 1 } # => 1 # Depends on `frozen_string_literal` p allocations { "hello!" } # => 0 or 1 Math on integers generally doesn't allocate anything, but it depends on the integer. When a number gets large enough, CRuby will allocate an object to represent that number. On 64 bit platforms, the largest whole number we can represent without allocating is 0x3FFF_FFFF_FFFF_FFFF. String literals will sometimes allocate, but it depends on the frozen_string_literal setting in your program. Here is an example of code that always allocates: p allocations { [1, 2] } # => 1 p allocations { { a: :b } } # => 1 p allocations { Object.new } # => 1 p allocations { "foo"[0, 1] } # => 1 Hopefully these examples are fairly straightforward. Arrays, hashes, objects, string slices, etc will allocate an object. Eliminating Intermediate Array Allocations At the Shopify after-party at RailsWorld, someone asked me a really great question. Their codebase ha

## Binary search finds things fast

DevFeed: [Binary search finds things fast](<https://devfeed.tech/articles/binary-search-finds-things-fast-39066.md>)

Original publisher: [Read original article](<https://blog.devdetails.com/p/binary-search-finds-things-fast>)

Author: Mike

Published: 2024-08-13T07:55:55Z

Content type: tutorial

Language: en

Sources: [Dev Details](<https://devfeed.tech/sources/dev-details.md>)

Topics: [Algorithm](<https://devfeed.tech/topics/algorithm.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [algorithm](<https://devfeed.tech/tags/algorithm.md>), [array](<https://devfeed.tech/tags/array.md>), [binary-search](<https://devfeed.tech/tags/binary-search.md>), [book](<https://devfeed.tech/tags/book.md>), [example](<https://devfeed.tech/tags/example.md>), [interactive](<https://devfeed.tech/tags/interactive.md>)

### AI overview

A tutorial explaining binary search, an efficient algorithm for finding an item's position in a sorted array by repeatedly halving the search range. It covers the requirement that the array be sorted, the search steps, and use cases including checking values, finding occurrences, and determining insertion points.

### Source excerpt

I wrote a small interactive book to teach binary search.

## Overthinking Leetcode's Two Sum with SIMD

DevFeed: [Overthinking Leetcode's Two Sum with SIMD](<https://devfeed.tech/articles/overthinking-leetcode-s-two-sum-with-simd-35478.md>)

Original publisher: [Read original article](<https://darkcoding.net/software/two-sum/>)

Author: Graham King

Published: 2022-10-09T07:00:00Z

Content type: tutorial

Language: en

Sources: [Graham King](<https://devfeed.tech/sources/graham-king.md>)

Topics: [Algorithms](<https://devfeed.tech/topics/algorithms.md>), [Code](<https://devfeed.tech/topics/code.md>), [Rust](<https://devfeed.tech/topics/rust.md>)

Tags: [algorithm](<https://devfeed.tech/tags/algorithm.md>), [algorithms](<https://devfeed.tech/tags/algorithms.md>), [array](<https://devfeed.tech/tags/array.md>), [avx](<https://devfeed.tech/tags/avx.md>), [benchmarks](<https://devfeed.tech/tags/benchmarks.md>), [code](<https://devfeed.tech/tags/code.md>), [complexity](<https://devfeed.tech/tags/complexity.md>), [interview](<https://devfeed.tech/tags/interview.md>), [performance](<https://devfeed.tech/tags/performance.md>), [rust](<https://devfeed.tech/tags/rust.md>), [simd](<https://devfeed.tech/tags/simd.md>), [software](<https://devfeed.tech/tags/software.md>)

### AI overview

This article examines the Two Sum problem by comparing a brute-force linear scan with a map-based solution. It discusses their complexity, implementation costs, and when the linear approach may be faster, including the possibility of using AVX-512 instructions.

### Source excerpt

When is the linear scan Two Sum solution faster than a map? What if we use AVX-512 instructions?

## Represent data with generic data structures

DevFeed: [Represent data with generic data structures](<https://devfeed.tech/articles/represent-data-with-generic-data-structures-37567.md>)

Original publisher: [Read original article](<https://blog.klipse.tech/databook/2022/06/22/generic-data-structures.html>)

Author: Yehonathan Sharvit

Published: 2022-06-22T02:33:24Z

Content type: article

Language: en

Sources: [Klipse](<https://devfeed.tech/sources/klipse.md>)

Topics: [Data structures](<https://devfeed.tech/topics/data-structures.md>), [Code](<https://devfeed.tech/topics/code.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Object-oriented programming (OOP)](<https://devfeed.tech/topics/oop.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [arrays](<https://devfeed.tech/tags/arrays.md>), [code](<https://devfeed.tech/tags/code.md>), [d](<https://devfeed.tech/tags/d.md>), [data-structures](<https://devfeed.tech/tags/data-structures.md>), [dop](<https://devfeed.tech/tags/dop.md>), [immutability](<https://devfeed.tech/tags/immutability.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [oop](<https://devfeed.tech/tags/oop.md>), [programming](<https://devfeed.tech/tags/programming.md>)

### AI overview

This article explores the second principle of Data-Oriented Programming: representing application data with generic data structures such as maps and arrays instead of specific classes. It also discusses other structures, including sets, trees, and queues, and describes benefits such as reusable generic functions and a flexible data model.

### Source excerpt

When adhering to Principle #1 of DOP, code is separated from data. DOP is not opinionated about the programming constructs to use for organizing the code, but it has a lot to say about how the data should be represented. This is the theme of Principle #2.

## How to Filter a SQL Nested Collection by a Value

DevFeed: [How to Filter a SQL Nested Collection by a Value](<https://devfeed.tech/articles/how-to-filter-a-sql-nested-collection-by-a-value-28940.md>)

Original publisher: [Read original article](<https://blog.jooq.org/how-to-filter-a-sql-nested-collection-by-a-value/>)

Author: lukaseder

Published: 2022-06-10T14:32:38Z

Content type: tutorial

Language: en

Sources: [jOOQ](<https://devfeed.tech/sources/jooq.md>)

Topics: [SQL](<https://devfeed.tech/topics/sql.md>), [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Stack Overflow](<https://devfeed.tech/topics/stackoverflow.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [array-agg](<https://devfeed.tech/tags/array-agg.md>), [derived-table](<https://devfeed.tech/tags/derived-table.md>), [filter](<https://devfeed.tech/tags/filter.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [jooq](<https://devfeed.tech/tags/jooq.md>), [multiset](<https://devfeed.tech/tags/multiset.md>), [multiset-agg](<https://devfeed.tech/tags/multiset-agg.md>), [nested-collections](<https://devfeed.tech/tags/nested-collections.md>), [order-of-operations](<https://devfeed.tech/tags/order-of-operations.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [predicate](<https://devfeed.tech/tags/predicate.md>), [sql](<https://devfeed.tech/tags/sql.md>)

### AI overview

This tutorial explains how to filter SQL nested collections by a value. It compares filtering arrays through a derived table with using PostgreSQL's ARRAY_AGG and group filtering, then shows a jOOQ version intended to work across supported relational database systems.

### Source excerpt

I stumbled upon a very interesting question on Stack Overflow about how to use jOOQ's MULTISET operator to nest a collection, and then filter the result by whether that nested collection contains a value. The question is jOOQ specific, but imagine, you have a query that nests collections using JSON in PostgreSQL. Assuming, as always, ... Continue reading How to Filter a SQL Nested Collection by a Value ->

## Ideas and Solutions for Advent of Code 2021 in Kotlin -- Part 4/4

DevFeed: [Ideas and Solutions for Advent of Code 2021 in Kotlin -- Part 4/4](<https://devfeed.tech/articles/ideas-and-solutions-for-advent-of-code-2021-in-kotlin-part-4-4-24736.md>)

Original publisher: [Read original article](<https://medium.com/xorum-io/ideas-and-solutions-for-advent-of-code-2021-in-kotlin-part-4-4-75c207692bdb?source=rss----92bb7980cc9f---4>)

Author: Yev Kanivets

Published: 2021-12-26T14:39:41Z

Content type: tutorial

Language: en

Sources: [xorum.io - Medium](<https://devfeed.tech/sources/xorum-io-medium.md>)

Topics: [Advent of Code](<https://devfeed.tech/topics/advent-of-code.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [3D](<https://devfeed.tech/topics/3d.md>), [pixel](<https://devfeed.tech/topics/pixel.md>)

Tags: [3d](<https://devfeed.tech/tags/3d.md>), [advent-of-code](<https://devfeed.tech/tags/advent-of-code.md>), [algorithms](<https://devfeed.tech/tags/algorithms.md>), [array](<https://devfeed.tech/tags/array.md>), [beacon](<https://devfeed.tech/tags/beacon.md>), [competitive-programming](<https://devfeed.tech/tags/competitive-programming.md>), [data-structures](<https://devfeed.tech/tags/data-structures.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [pixel](<https://devfeed.tech/tags/pixel.md>), [points](<https://devfeed.tech/tags/points.md>), [scanner](<https://devfeed.tech/tags/scanner.md>), [solutions](<https://devfeed.tech/tags/solutions.md>)

### AI overview

A Kotlin walkthrough of Advent of Code 2021 tasks 19 and 20. It explains matching rotated point sets in 3D space using beacon intersections, then enhancing an image represented as a 2D pixel array while accounting for infinite padding and changing background values.

### Source excerpt

Ideas and Solutions for Advent of Code 2021 in Kotlin -- Part 4/4 The final week of Advent of Code was, obviously, the most challenging one. To be honest I was close to being happy with just a silver star multiple times. But at the end, tenacity made the difference. 50 stars are mine this year 🌟 Ideas and Solutions for tasks 1 to 6 can be found here, for tasks 7 to 12 -- here, for tasks 13 to 18 -- here. Day 19: Beacon Scanner We are provided with several sets of points in 3D space. Those points are rotated differently in each set, so we don't know how X, Y, and Z coordinates are aligned between sets. Our goal is to merge all those sets into a single group by matching points (sub-task one) and find the most significant distance between coordinate origins after they are matched. Here is the complete task. This is an exciting task! I've initially learned about this idea from The Three-Body Problem book, which introduced the concept of locating any star in the Universe by the distances from a few nearest stars -- in our case, "a few" means 12. Think about it as a star fingerprint ;) So to match the sets of points in 3D space, we need: check all combinations of rotations in three dimensions (in our task, the step is 90 degrees, so there are 48 combinations) for the whole set assume that each pair of points from the first set and the second set is an intersection by adjusting all points to that pair check how many adjusted points intersect between the two sets if there are more than 12 intersections, voilá -- the sets are matched The embedded Kotlin's functions like intersect, map, and mapNotNull make the solution, even for such a complex task, elegant. Day 20: Trench Map This image-enhancing task provides us with the initial photo (2D array of black and white pixels), and enhancing guidance (1D array). Enhancing happens in steps, where for each pixel, we found its enhanced value as a result of a combination of itself + all eight adjacent pixels. Here is the complete task. We

## Ideas and Solutions for Advent of Code 2021 in Kotlin -- Part 3/4

DevFeed: [Ideas and Solutions for Advent of Code 2021 in Kotlin -- Part 3/4](<https://devfeed.tech/articles/ideas-and-solutions-for-advent-of-code-2021-in-kotlin-part-3-4-24735.md>)

Original publisher: [Read original article](<https://medium.com/xorum-io/ideas-and-solutions-for-advent-of-code-2021-in-kotlin-part-3-4-dbfd577703cc?source=rss----92bb7980cc9f---4>)

Author: Yev Kanivets

Published: 2021-12-26T14:22:49Z

Content type: tutorial

Language: en

Sources: [xorum.io - Medium](<https://devfeed.tech/sources/xorum-io-medium.md>)

Topics: [Advent of Code](<https://devfeed.tech/topics/advent-of-code.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [competitive-programming](<https://devfeed.tech/topics/competitive-programming.md>), [Graphs](<https://devfeed.tech/topics/graphs.md>), [math](<https://devfeed.tech/topics/math.md>)

Tags: [advent-of-code](<https://devfeed.tech/tags/advent-of-code.md>), [algorithms](<https://devfeed.tech/tags/algorithms.md>), [array](<https://devfeed.tech/tags/array.md>), [code](<https://devfeed.tech/tags/code.md>), [competitive-programming](<https://devfeed.tech/tags/competitive-programming.md>), [data-structures](<https://devfeed.tech/tags/data-structures.md>), [graph-theory](<https://devfeed.tech/tags/graph-theory.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [memory](<https://devfeed.tech/tags/memory.md>), [pairs](<https://devfeed.tech/tags/pairs.md>), [programming](<https://devfeed.tech/tags/programming.md>), [solutions](<https://devfeed.tech/tags/solutions.md>), [time](<https://devfeed.tech/tags/time.md>)

### AI overview

This article presents high-level ideas and Kotlin solutions for Advent of Code 2021 tasks from days 13 to 15. It discusses folding a 2D array, modeling polymer growth with dynamic programming, and finding a shortest path in a 2D array.

### Source excerpt

Ideas and Solutions for Advent of Code 2021 in Kotlin -- Part 3/4 The third week of Advent of Code requires more time and even some competitive programming knowledge like dynamic programming and graph theory. In this article, I share some high-level ideas and my solutions if you need a hint or a few to get that gold star. Ideas and Solutions for tasks 1 to 6 can be found here, for tasks 7 to 12 -- here. Day 13: Transparent Origami The 2D array contains two types of symbols -- . and #. This array can be folded horizontally and vertically multiple times. When folding # symbols replace . symbols, but not vice versa. Here is the complete task. This is a modeling task, which you can do on the 2D array itself, but the possible range is quite large, so you can hit a memory limit. The smarter solution would be to fold the # symbols (the initial input, actually). Such folding can be done with Kotlin's fold function using the initial value of # symbol positions and mapNotNull, which mirrors X or Y coordinates depending on the fold direction. Here is my solution. Day 14: Extended Polymerization We get the initial string (template) consisting of uppercase letters, which describe the initial state of the polymer. The list of pair insertion rules allows growing the initial polymer step by step exponentially. We need to model this growth during 10 (first sub-task) and 40 (second sub-task) steps. Here is the complete task. The first sub-task can be solved just by modeling, but even 20 steps are too long and require too much memory and time. The (much) better solution is based on dynamic programming. You can easily see that every pair grows independently of others (new elements are always added inside the pair). It means that the solution can be found for each pair separately and then combined. It doesn't speed up things sufficiently though. But makes the solution easier? Yes. Now, let's grow each pair step by step. So at each step, every pair (usually) produces two more pairs, which h

## Ideas and Solutions for Advent of Code 2021 in Kotlin -- Part 1/4

DevFeed: [Ideas and Solutions for Advent of Code 2021 in Kotlin -- Part 1/4](<https://devfeed.tech/articles/ideas-and-solutions-for-advent-of-code-2021-in-kotlin-part-1-4-24733.md>)

Original publisher: [Read original article](<https://medium.com/xorum-io/ideas-and-solutions-for-advent-of-code-2021-in-kotlin-part-1-4-9a16d9e3bd57?source=rss----92bb7980cc9f---4>)

Author: Yev Kanivets

Published: 2021-12-13T15:31:55Z

Content type: tutorial

Language: en

Sources: [xorum.io - Medium](<https://devfeed.tech/sources/xorum-io-medium.md>)

Topics: [Advent of Code](<https://devfeed.tech/topics/advent-of-code.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [advent-of-code](<https://devfeed.tech/tags/advent-of-code.md>), [algorithms](<https://devfeed.tech/tags/algorithms.md>), [array](<https://devfeed.tech/tags/array.md>), [commands](<https://devfeed.tech/tags/commands.md>), [competitive-programming](<https://devfeed.tech/tags/competitive-programming.md>), [data-structures](<https://devfeed.tech/tags/data-structures.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [map](<https://devfeed.tech/tags/map.md>), [programming](<https://devfeed.tech/tags/programming.md>), [solutions](<https://devfeed.tech/tags/solutions.md>)

### AI overview

A Kotlin-focused walkthrough of the first six Advent of Code 2021 puzzles. It explains the key solution ideas for the early tasks, including array comparisons, submarine movement modeling, and binary-number calculations, while linking to source code for further guidance.

### Source excerpt

Ideas and Solutions for Advent of Code 2021 in Kotlin -- Part 1/4 There are so many things to do before Christmas, so I was always wondering how people find extra time to solve a daily programming puzzle of Advent of Code. Well, this year I'm one of those lucky folks with a bunch of spare time. Advent of Code is an annual event of Christmas-oriented programming challenges started December 2015. Every year since then, on the first day of December, a programming puzzle is published every day for twenty-four days. You can solve the puzzle and provide an answer using the language of your choice. Extra reason by JetBrains in the form of the giveaway of some Kotlin care packages has certainly contributed to my motivation. But what's the point of solving tasks without sharing your ideas and solutions with the community ;) So here we are, the first six tasks. What's special about this article? I won't be sharing the complete editorial, but the key idea only, so you can still solve the task by yourself. And if you need more guidance, there is a source code linked. Day 1: Sonar Sweep We are given an array of heights of a seafloor. We need to calculate the number of times heights (sub-task one) and sliding triples of heights (sub-task two) are increasing. Complete task is here. To solve both tasks we need to go from left to right and compare the previous element (or sliding triple) to the current one. That's pretty simple, but challenge yourself to craft the beautiful code. In Kotlin we may consider using drop and foldIndexed functions for this. Here is my solution. Day 2: Dive! The submarine can move in 2D space (horizontal position and depth) controlled by the set of commands. Moves mechanics are slightly different between subtasks, but the overall approach and goal are the same -- model moves and find the resulting position. Complete task is here. The first sub-task can be solved by folding horizontal position and depth changes, but the second sub-task should be modeled exact

## Learning Zig - Day 2

DevFeed: [Learning Zig - Day 2](<https://devfeed.tech/articles/learning-zig-day-2-38541.md>)

Original publisher: [Read original article](<https://msfjarvis.dev/posts/learning-zig--day-2/>)

Author: Harsh Shandilya

Published: 2021-05-15T06:30:00Z

Content type: tutorial

Language: en

Sources: [Posts on Harsh Shandilya](<https://devfeed.tech/sources/posts-on-harsh-shandilya.md>)

Topics: [Zig](<https://devfeed.tech/topics/zig.md>), [Code](<https://devfeed.tech/topics/code.md>), [syntax](<https://devfeed.tech/topics/syntax.md>), [test](<https://devfeed.tech/topics/test.md>), [formatting](<https://devfeed.tech/topics/formatting.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [getting-started](<https://devfeed.tech/tags/getting-started.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [learn](<https://devfeed.tech/tags/learn.md>), [learning](<https://devfeed.tech/tags/learning.md>), [rust](<https://devfeed.tech/tags/rust.md>), [testing](<https://devfeed.tech/tags/testing.md>), [zig](<https://devfeed.tech/tags/zig.md>)

### AI overview

A second-day learning journal about Zig covers rebuilding a Rust library, using ziglearn.org, and early observations about Zig's defaults, arrays, testing, and defer feature. The author compares several behaviors with Rust and notes unresolved questions about formatting and diagnostics.

### Source excerpt

Onwards in our quest to learn Zig

## Google Brain's Jax and Flax

DevFeed: [Google Brain's Jax and Flax](<https://devfeed.tech/articles/google-brain-s-jax-and-flax-29478.md>)

Original publisher: [Read original article](<http://lambda-the-ultimate.org/google-brain-jax>)

Published: 2021-01-15T13:59:26Z

Content type: opinion

Language: en

Sources: [Lambda the Ultimate](<https://devfeed.tech/sources/lambda-the-ultimate.md>)

Topics: [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>), [Deep learning](<https://devfeed.tech/topics/deep-learning.md>), [Google](<https://devfeed.tech/topics/google.md>), [Algorithms](<https://devfeed.tech/topics/algorithms.md>), [NumPy](<https://devfeed.tech/topics/numpy.md>), [Python](<https://devfeed.tech/topics/python.md>), [Optimization](<https://devfeed.tech/topics/optimization.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [algorithms](<https://devfeed.tech/tags/algorithms.md>), [array](<https://devfeed.tech/tags/array.md>), [customization](<https://devfeed.tech/tags/customization.md>), [deep-learning](<https://devfeed.tech/tags/deep-learning.md>), [google](<https://devfeed.tech/tags/google.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [python](<https://devfeed.tech/tags/python.md>), [scientific-programming](<https://devfeed.tech/tags/scientific-programming.md>), [software-engineering](<https://devfeed.tech/tags/software-engineering.md>)

### AI overview

The article introduces Google Brain's JAX and Flax alongside TensorFlow. It describes JAX as a higher-level language for specifying deep learning algorithms, combining Autograd and XLA, while Flax supports customization of existing models. It ends by asking about the future of domain-specific languages for AI.

### Source excerpt

Google's AI division, Google Brain, has two main products for deep learning: TensorFlow and Jax. While TensorFlow is best known, Jax can be thought of as a higher-level language for specifying deep learning algorithms while automatically eliding code that doesn't need to run as part of the model. Jax evolved from Autograd, and is a combination of Autograd and XLA. Autograd "can automatically differentiate native Python and Numpy code. It can handle a large subset of Python's features, including loops, ifs, recursion and closures, and it can even take derivatives of derivatives of derivatives. It supports reverse-mode differentiation (a.k.a. backpropagation), which means it can efficiently take gradients of scalar-valued functions with respect to array-valued arguments, as well as forward-mode differentiation, and the two can be composed arbitrarily. The main intended application of Autograd is gradient-based optimization." Flax is then built on top of Jax, and allows for easier customization of existing models. What do you see as the future of domain specific languages for AI?

[Next page](<https://devfeed.tech/tags/array.md?cursor=WyIyMDIxLTAxLTE1VDEzOjU5OjI2KzAwOjAwIiwgIjU5YmZhODJkLTAyZmItNDQ4ZS1iMjhiLTlkZjdhODE3N2FjOSJd>)