All bites
The whole library, newest first. Filter by what you are here for, or pick a topic if you already know.
8668 bites
Page 80
Profiling a Rust hot loop with perf
Build with debuginfo, perf record cycles or cache-misses, perf report then perf annotate to map counters to source/asm; flamegraph for hotspots.
Diagnosing Go memory leaks with pprof heap profiles
Expose net/http/pprof, grab /debug/pprof/heap, analyze inuse_space for live retention versus alloc_space for cumulative allocation; rising inuse over time points to a leak.
Cancellation: Go context vs Rust sync stdlib
Go's context.Context threads a Done channel and deadline through call chains; Rust std has no built-in cancellation, so you wire an AtomicBool or channel and check it.
Network read/write timeouts in Go vs Rust stdlib
Go uses SetReadDeadline/SetWriteDeadline as absolute times; Rust uses set_read_timeout/set_write_timeout as durations on TcpStream.
Concurrent TCP server: Go goroutines vs Rust std::thread
Both accept in a loop; Go spawns a goroutine per connection (go handle(conn)); Rust spawns an OS thread (thread::spawn moving the stream).
Purpose and mechanism of a Rust build.rs script
Build.rs compiles and runs before the crate, emitting cargo: directives via stdout to set link flags, env vars, and rerun triggers; used to compile C, generate code, or probe the system.
Rust async/await vs Go goroutines
Go schedules goroutines on a built-in runtime transparently; Rust futures are inert until polled by an external runtime like Tokio, and async colors functions.
Sharing mutable state: Go mutex vs Rust Arc Mutex
Go uses sync.Mutex by convention; Rust wraps data in Arc<Mutex<T>> so locking is mandatory, enforced by Send/Sync and the borrow checker.
Associated types vs generic type parameters in traits
Associated types fix one type per implementer; generics allow many impls; Iterator::Item is the canonical example.
Value versus pointer receivers and interface satisfaction
Value-receiver methods belong to both T and *T, but pointer-receiver methods belong only to *T, so a value of T may not satisfy an interface.
When to panic in Go versus Rust
Both reserve panic for unrecoverable bugs and use values, Result or error, for expected failures; Rust's type system pushes more cases to Result.
Rust borrow rules versus Go race prevention
Rust's aliasing-XOR-mutability rule plus Send and Sync make races a compile error; Go prevents them at runtime via channels, mutexes and the race detector.
Rust workspace versus single crate for plugins
A workspace gives incremental compilation, enforced API boundaries via a shared api crate, and per-plugin deps; a single crate is simpler but recompiles wholesale and blurs boundaries.
Rust binary and library crates in one project
A binary crate has main and produces an executable; a library crate has lib.rs and is reusable; put logic in the lib and a thin main that calls it.
Refactoring under Go simplicity versus Rust correctness
Rust's type system catches broken invariants at compile time so refactors are guided; Go's explicitness keeps code readable but shifts safety to tests and discipline.
I/O Stream Abstractions
I/O stream abstractions like Go's io.Reader and io.Writer model data as a flow of bytes behind a tiny interface, so files, sockets, buffers and encoders compose interchangeably without each one knowing the others' concrete type.
Implicit Interface Satisfaction in Go
Go types satisfy an interface automatically by having the right methods, with no explicit implements declaration. This structural typing decouples implementations from interface definitions, so you can define interfaces around how you use a type without…
Dart reduce versus fold on collections
Reduce combines same-type elements and throws on empty; fold takes an initial value and accumulator of any type, safe on empty.
Auth-protected routes via GoRouter redirect
A top-level redirect reads auth state, sends unauthenticated users to login, sends logged-in users away from login, and uses refreshListenable to re-evaluate on auth change.
Isolating and reducing excessive widget rebuilds
Push state down, use const subtrees, rebuild only listeners with ValueListenableBuilder, isolate repaints with RepaintBoundary.