tech
Go Proposal: A New Json Lib Ep1
Go Proposal: A New Json Lib Ep1. Background JSON is a lightweight data interchange format that has been favored by developers for its flexible features sin。
tech
Go Proposal: A New Json Lib Ep1. Background JSON is a lightweight data interchange format that has been favored by developers for its flexible features sin。
tech
Go 提案: JSON v2 来了. 背景 JSON 是一种轻量级的数据交换格式,Go 语言的 encoding/json 包自诞生以来已有十年之久,它凭借其灵活的特性赢得了开发者的青睐。开发者可以通过结构体标签自定义字段的 JSON 表现形式,也可以让 Go 类型自定义其在 JSON 中的表现形式。然而,随。
tech
Recently, I discovered that the Go standard library includes a built-in implementation of varint, found in encoding/binary/varint.go. This implementation is similar to the varint used in protobuf. Using the Golang standard library's varint source code, we will systematically learn and review the concept of
tech
最近发现 Golang 标准库竟然自带了 varint 的实现,代码位置在 encoding/binary/varint.go,这个跟protobuf里面的varint实现基本是一致的。刚好借助 golang 标准库的 varint 源码,我们来系统地学习和梳理下 varint。 熟悉 protobuf 的人肯定对 varint 不陌生,protobuf 里面除了带 fix (如 fixed32、fixed64) 之外的整数类型, 都是 varint 编码。 varint 的出现主要是为了解决两个问题: 1. 空间效率:以 uint64 类型为例,可以表示的最大值为 18446744073709551615。然而在实际业务场景中,我们通常处理的整数值远小于 uint64 的最大值。假设在我们的业务中,需要处理的整数值仅为 1,但在网络传输过程中,
tech
Use macOS's built-in tool `dmc` to simulate slow disk performance for testing. It offers various profiles to adjust speed easily.
tech
Decrypt Go: `runtime.SetFinalizer`. If we want to do some resource release before an object is GC, we can use returns.SetFinalizer . It’s like executing de。
tech
本文介绍了Go语言中的runtime.SetFinalizer函数,探讨了如何在对象被垃圾回收之前执行清理操作。通过示例代码,展示了SetFinalizer的用法及其潜在问题,如内存泄漏和对象生命周期延长。文章还提到在实际应用中,SetFinalizer的使用较少,但在Go源码中有广泛应用,提供了对资源管理的深刻见解。
tech
如何在 Go 中避免内存泄露?关注关闭文件、HTTP 响应体、字符串管理及 goroutine 使用。及时释放资源,避免循环引用,使用 defer 时要小心,助你写出健壮的代码!#GoLang #内存泄露
tech
In the previous article, I implemented a simple RPC interface using the net/rpc package and tried out the Gob encoding that comes with net/rpc and JSON encoding to learn some basics of Golang RPC. In this post, I'll combine net/rpc with protobuf and create my
tech
Exploring the Benefits of Using `tmux`: A Quick Guide to Terminal Multiplexing. tmux is a terminal multiplexer: it enables a number of terminals to be crea。
tech
Mac: tmux 最佳实践. tmux 是一个终端多路复用器:它允许从单个屏幕创建、访问和控制多个终端。 tmux 可能会与屏幕分离并继续在后台运行,然后重新连接。 第一次看到 tmux 的介绍的时候,我其实没什么感觉,觉得没什么.后面用terminal多了,遇到了一些问题,然后尝试解决,最后我重新认真学习。
tech
Go High-Performance Programming EP9: Escape Analysis. From the perspective of the Go compiler, memory allocation happens in two places: the stack and the h。