Tagged articles
cgo
25 articles · Page 1 of 1

TonyBaiSep 11, 2026 · Backend Development
Debian Code Search replaced its 7-year-old C TurboPFor library with pure Go using Go 1.26/1.27's experimental simd/archsimd package, achieving 3x speedup via AVX2 vertical layout and a further 2x via AI-suggested AVX-512 positional popcount (GF2P8AFFINEQB + VPOPCNTB), reaching 7 IPC near hardware limits.
AVX-512AVX2Go
0 likes · 30 min read


TonyBaiJul 16, 2026 · Backend Development
The article dissects the Go 1.28 planning notes, detailing upcoming compiler memory‑free mechanisms, pre‑compiled Cgo support, revived generic containers, SIMD extensions, Wasm stack‑switching, structured struct tags, sharded counters, and GC scalability work, while explaining the motivations, trade‑offs, and open questions behind each proposal.
CompilerGoGo 1.28
0 likes · 25 min read

The article recounts a near‑automatic library‑development experiment that started from a PRD, split into 15 issues, executed by a Loop Engineering agent, and resulted in a fully functional Go RDMA library while exposing hidden costs, bugs, and lessons learned.
GoLoop EngineeringRDMA
0 likes · 18 min read

The article dissects why Go’s standard regexp package lags behind Python and other languages, tracing the slowdown to a pure‑Go implementation that avoids CGO, the choice of a Thompson‑NFA engine for safety, heavy UTF‑8 rune decoding, memory‑intensive NFA simulation, and shows how community projects like coregex reclaim performance while preserving Go’s safety guarantees.
GoSIMDcgo
0 likes · 13 min read

FrankenPHP now runs natively on Windows with full extension support, delivering up to 3.6× speed improvements thanks to a new CGO‑Clang integration in Go 1.26, while the project overcame major compiler incompatibilities through a series of technical experiments and a breakthrough patch.
FrankenPHPPHPcgo
0 likes · 6 min read


TonyBaiJan 21, 2026 · Artificial Intelligence
This article walks Go developers through the fundamentals of GPU architecture and CUDA, demonstrates a complete CGO‑based matrix‑multiplication project, offers performance‑tuning tips such as minimizing PCIe transfers and leveraging shared memory, and presents a PureGo alternative for seamless Go‑GPU integration.
CUDAGPU computingGo
0 likes · 17 min read

This article provides a comprehensive, low‑level explanation of Go’s CGO bridge, covering its purpose, performance overhead, scheduler interaction, pointer safety rules, memory‑management guidelines, common use‑cases, scenarios to avoid, optimization techniques, and a collection of high‑frequency interview questions with model answers.
ConcurrencyGoInteroperability
0 likes · 8 min read

This comprehensive guide explains CGO fundamentals, demonstrates basic and advanced usage with practical code examples, covers type conversion, calling C standard libraries, handling external C files, callbacks, struct passing, memory‑management best practices, real‑world scenarios, limitations, and alternative approaches for Go developers.
C integrationGoInterop
0 likes · 9 min read

Learn how to integrate Go and Java by compiling Go code into a shared library, exposing functions via cgo and JNI, and invoking them from Java with detailed setup, code examples, handling of primitive and complex data types, and full build‑and‑run instructions.
GoInteroperabilityJNI
0 likes · 12 min read

During a gray‑release, a Go‑Rust service repeatedly crashed when a dependent process was hot‑upgraded; the root cause was an unhandled SIGPIPE signal generated by the kernel on a broken TCP connection, which terminated the process without a core dump, and the article explains the kernel mechanics and the solution of ignoring SIGPIPE.
GoLinux signalsRust
0 likes · 16 min read

This article explains how the Linux SIGPIPE signal is generated during broken TCP connections, why the default kernel handling can terminate Go services that call Rust code via cgo, and provides practical code examples to ignore SIGPIPE and avoid silent process exits.
GoLinux signalsRust
0 likes · 15 min read

This article explains how the SIGPIPE signal is generated in Linux, why it can cause Go‑Rust services to crash without a core dump, and how to prevent it by configuring the signal handler to ignore SIGPIPE.
GoLinuxRust
0 likes · 15 min read

This article explains how to call Go functions from C within the same process, covering the three‑step implementation, compilation into a shared library, the C invocation code, and a detailed walkthrough of the cgo and Go runtime mechanisms that make cross‑language calls possible.
Interoperabilitycgocross-language
0 likes · 13 min read

This article explains how to invoke Go functions from C within the same process, covering the three‑step implementation, the required cgo compilation commands, the generated intermediate files, and the runtime mechanisms such as crosscall2 and stack switching that make cross‑language calls possible.
C++FFIInteroperability
0 likes · 12 min read

This article explains Go's uintptr type, its definition, typical scenarios such as cgo interaction and system calls, provides Linux and Windows code examples, and highlights key differences from regular pointers to help developers use it safely and effectively.
GoLow-Level ProgrammingUnsafe
0 likes · 6 min read

This article explains why Go projects using cgo often fail due to missing C headers like sqlcli1.h and presents three practical solutions—conditional compilation with build tags, dependency injection, and Docker containers—to ensure reliable builds across different environments.
Backendbuild-tagscgo
0 likes · 4 min read

This article details how to train a YOLOv8‑pose model for license‑plate detection, convert it to TensorRT engine, implement C++ inference and preprocessing, expose the functionality via CGO to Go, and assemble a lightweight web service for real‑time plate recognition.
C++GoTensorRT
0 likes · 12 min read

The Shopee Off‑Platform Ads team built a GPU‑accelerated Creative Rendering System that uses a four‑layer architecture, CGO‑bridged C/C++ kernels, and template caching to process billions of product images daily, achieving roughly ten‑fold speedup, half the cost, and far reduced rack space while handling high concurrency.
AdvertisingCUDAGPU
0 likes · 23 min read

This article demonstrates three Go black‑magic techniques—using go:linkname to call private runtime functions like memmove and growslice, employing cgo to invoke C code, and embedding Plan 9 assembly—to bypass safety checks and achieve significant performance improvements, though they rely on unsafe practices.
GoUnsafecgo
0 likes · 17 min read

This article explains why Go programs can still exhibit memory growth despite automatic garbage collection, describes how to identify and diagnose such issues with the built‑in pprof tool, and details the underlying sampling mechanism, memory fragmentation, and cgo‑related allocations.
GCGoRuntime
0 likes · 9 min read

This article explores several methods for creating PHP extensions—including native C, Zephir, php-cpp, php-x, and CGO—provides sample code, describes compilation steps, and compares their execution speed using a Fibonacci benchmark with and without PHP JIT.
BackendJITPHP
0 likes · 6 min read

The case study walks through debugging a Go production service that regularly spiked to over 6 GB of resident memory, revealing that unbuffered channel leaks, mis‑configured HTTP client timeouts, and ultimately a cgo‑based image‑processing library spawning unmanaged threads caused the leaks, and outlines a systematic troubleshooting workflow.
DebuggingMemory Leakcgo
0 likes · 12 min read

The article surveys a range of Go standard‑library performance tricks—from using sync.Pool and zero‑copy string/byte conversions to reducing lock contention, leveraging go:linkname, caching call‑frame data, optimizing cgo calls, employing custom epoll, SIMD, and occasional JIT—while urging profiling‑first, readability‑preserving optimizations.
Gocgosync.Pool
0 likes · 17 min read

This article explains why Python's ctypes returns incorrect values when invoking Go-compiled shared libraries, shows how to map C types correctly, and provides step‑by‑step code examples for handling both integer and string return values using proper restype declarations.
GoInteroperabilityPython
0 likes · 8 min read

This article explains the history and architecture of PostgreSQL's Foreign Data Wrapper (FDW), details the required database objects and callback functions, and provides a step‑by‑step guide for implementing an FDW in Go using cgo, including code examples, build instructions, and performance considerations.
FDWGoPostgreSQL
0 likes · 26 min read
