Tagged articles
23 articles
Page 1 of 1
Tech Musings
Tech Musings
Feb 3, 2026 · Backend Development

Why Go’s range Loop Can Slow You Down with Large Structs—and How to Fix It

In Go, using a range loop on slices of large structs implicitly copies each element, leading to significant performance loss, and modifying the loop variable does not affect the original slice; this article explains the copying behavior, benchmarks three loop styles, and offers practical guidelines to write fast and correct code.

benchmarkperformancerange
0 likes · 9 min read
Why Go’s range Loop Can Slow You Down with Large Structs—and How to Fix It
Liangxu Linux
Liangxu Linux
Nov 24, 2025 · Fundamentals

Understanding Struct Alignment and Over‑Aligned Types in C/C++

This article explains the natural alignment requirements of C/C++ data types, how structs are padded and aligned based on member alignments, the hardware, cache and compiler reasons for alignment, and the concept of over‑aligned types with practical examples and usage guidelines.

C++c++compiler
0 likes · 11 min read
Understanding Struct Alignment and Over‑Aligned Types in C/C++
Radish, Keep Going!
Radish, Keep Going!
Jan 20, 2025 · Fundamentals

Why Memory Alignment Matters in Go: Performance, Pitfalls, and Tools

This article explains Go's memory alignment concepts, why alignment is needed, demonstrates real-world layout differences with examples, discusses performance and portability impacts, and introduces tools like fieldalignment and structlayout to detect and fix alignment issues in Go programs.

Toolingmemory alignmentstruct
0 likes · 14 min read
Why Memory Alignment Matters in Go: Performance, Pitfalls, and Tools
Ops Development & AI Practice
Ops Development & AI Practice
Mar 1, 2024 · Backend Development

Master Go Reflection: Read and Modify Struct Fields at Runtime

This article explains Go's powerful reflection feature, walks through importing the reflect package, outlines the step‑by‑step process to obtain Type and Value objects, and provides complete code examples that read, modify, and display struct fields while noting performance considerations.

GoReflectionprogramming
0 likes · 5 min read
Master Go Reflection: Read and Modify Struct Fields at Runtime
MaGe Linux Operations
MaGe Linux Operations
Nov 27, 2023 · Fundamentals

Mastering Go Structs: From Definition to Advanced Embedding

This comprehensive guide walks you through Go structs—covering their definition, instantiation, methods, receivers, anonymous fields, embedding, and method expressions—while providing clear code examples and practical guidelines for effective use in Go programming.

BackendEmbeddingGo
0 likes · 9 min read
Mastering Go Structs: From Definition to Advanced Embedding
Liangxu Linux
Liangxu Linux
Oct 15, 2023 · Fundamentals

Mastering C Structs: Definitions, Alignment, and Practical Usage

This guide explains C structs—from basic definitions and declaration styles to memory alignment, byte sizing, bit‑field handling, nested structures, and using structs as function parameters—providing clear code examples and practical tips for efficient embedded and systems programming.

Initializationbit-fieldsc++
0 likes · 29 min read
Mastering C Structs: Definitions, Alignment, and Practical Usage
NetEase Cloud Music Tech Team
NetEase Cloud Music Tech Team
Jun 16, 2023 · Fundamentals

The Semantics of nil in Swift

The article explains that Swift’s nil differs from Objective‑C’s null pointer by representing ‘no value’ for any type through optionals, details how various optionals (Bool?, String?, class?, enum?) are encoded in memory, shows the extra byte cost for Int?, and advises minimizing optional Int fields in structs, using 0 when appropriate.

ClassMemory OptimizationSwift
0 likes · 6 min read
The Semantics of nil in Swift
AI Cyberspace
AI Cyberspace
Mar 2, 2023 · Fundamentals

Mastering C Structures: From Declaration to Bit Fields

This article provides a comprehensive guide to C structures, covering declaration, variable definition, typedef aliases, initialization methods, pointer usage, member access, memory layout, nested structs, and bit fields, complete with code examples and visual illustrations to help readers understand and apply these concepts effectively.

bit fieldc++memory layout
0 likes · 12 min read
Mastering C Structures: From Declaration to Bit Fields
Tencent Cloud Developer
Tencent Cloud Developer
Sep 29, 2022 · Backend Development

Analyzing Go Memory Layout and Object Dumping

The article demonstrates how to examine a running Go program’s memory layout by defining example structs, using unsafe.Sizeof/Alignof, dumping writable regions via a Bash script and GDB, and locating fields and string constants in the resulting memory dumps to verify object representation.

GoHeap InspectionLinux
0 likes · 27 min read
Analyzing Go Memory Layout and Object Dumping
MaGe Linux Operations
MaGe Linux Operations
Jun 8, 2022 · Backend Development

Simplify JSON Handling in Go: From Maps to Structs and Powerful Libraries

This article explains why processing JSON in a statically‑typed language like Go can be cumbersome, demonstrates two basic approaches—using map[string]interface{} and struct tags—highlights their limitations, and introduces third‑party libraries such as SJSON and GJSON that make JSON reading and writing more concise and efficient.

BackendJSONgjson
0 likes · 9 min read
Simplify JSON Handling in Go: From Maps to Structs and Powerful Libraries
360 Tech Engineering
360 Tech Engineering
Mar 6, 2020 · Fundamentals

Understanding Method Sets, Interfaces, and Embedding in Go

This article explains Go's method sets, the relationship between method receivers and method sets, how interfaces work, and the role of embedding, providing code examples that illustrate value vs pointer receivers, interface implementation rules, and embedding differences for struct types.

EmbeddingInterfacemethod set
0 likes · 10 min read
Understanding Method Sets, Interfaces, and Embedding in Go