Transitioning to GoTRANSITIONING TO GO SEP 20 2023 Robert Pająk pellared @ GitHub SplunkHello whoami fundamentals going further more, more q&a 01 02 03 04 05whoamiROBERT PAJĄK Go maintainer Go language committee Tour of Go 2. Read and try: How to Write Go Code 3. Read and follow: Effective Go 4. Read and follow: CodeReviewComments 5. Check: Go by Examplehttps://go.dev/tourhttps://go.dev/doc/codehttps://go.dev com/golang/go/wiki/CodeReviewCommentshttps://gobyexample.comgoing furtherhttps://www.gopl.iohttps://go.dev/ref/memhttps://exercism.orghttps://quii.gitbook.io/learn-go-with-testshttps://go101.orghttps://go.dev/blogmore0 码力 | 30 页 | 1.53 MB | 5 月前3
1.2 Go in TiDBGo in TiDB 申砾@PingCAP Agenda • About Me • What is TiDB • TiDB Architecture • SQL Layer Internal • Golang in TiDB • Next Step of TiDB About Me • Shen Li (申砾) • Tech Lead of TiDB, VP of Engineering Why Go? • Productivity • Concurrency • Great for network programming • GC • Standard libraries && Tools • Good performance • Quick improvement Go in TiDB • More than 100k lines of Go code and session is hard • Account for large memory allocation • Account for memory consuming operators New in Go1.8 • Better GC • Pauses 50μs • sort.Slice Next Step of TiDB • Switch to gRPC • Document support0 码力 | 27 页 | 935.47 KB | 6 月前3
Go Compile Time InstrumentationGo compile time instrumentation Przemysław Delewski February 18, 2025 Warsaw, PolandAgenda 1. Short bio 2. Observability domain 3. OpenTelemetry 4. History of OpenTelemetry go compile time instrumentation I’m also founding member of the OpenTelemetry Go compile-time instrumentation project https://github.com/open-telemetry/community/blo b/main/projects/go-compile-instrumentation.mdSoftware complexity spanHistory of OpenTelemetry go instrumentationBeginnings of go instrumentation Everything started with two proposals: - https://github.com/open-telemetry/opentelemetry-go-instrumen tation/issues/30 码力 | 27 页 | 1.74 MB | 6 月前3
1.3 Go practices in TiDB 姚维Go Practices in TiDB 姚维 PingCAP wink@pingcap.com Agenda ● How to build a stable database ○ Schrodinger-test platform ○ Failpoint injection ○ Goroutine-leak detection ● Optimization ○ Chunk vs interface{} errors.New("mock commit error") // } …. } https://github.com/pingcap/tidb/blob/master/store/tikv/txn.go#L223 The generated gofail code func (txn *tikvTxn) Commit(ctx context.Context) error { if vmockCommitError or: __fp_mockCommitError.BadType(vmockCommitError, "bool"); }; …. } $ gofail enable store/tikv/txn.go Why we need a new failpoint ● Generated code is not readable ● Concurrent testing will use the same0 码力 | 32 页 | 1.76 MB | 6 月前3
Hello 算法 1.2.0 繁体中文 C语言 版(2?) 等。 2. Q & A Q:尾遞迴的空間複雜度是 ?(1) 嗎? 理論上,尾遞迴函式的空間複雜度可以最佳化至 ?(1) 。不過絕大多數程式語言(例如 Java、Python、C++、 Go、C# 等)不支持自動最佳化尾遞迴,因此通常認為空間複雜度是 ?(?) 。 Q:函式和方法這兩個術語的區別是什麼? 函式(function)可以被獨立執行,所有參數都以顯式傳遞。方法(method)與一個物件關聯,被隱式傳遞給 位元組;如果有字元超出了 ASCII 範圍,但全部在基本多語言平面(BMP)內,則每個字元佔用 2 位元組;如果有超出 BMP 的字元,則 每個字元佔用 4 位元組。 ‧ Go 語言的 string 型別在內部使用 UTF‑8 編碼。Go 語言還提供了 rune 型別,它用於表示單個 Unicode 碼點。 ‧ Rust 語言的 str 和 String 型別在內部使用 UTF‑8 編碼。Rust 也提供了 鏈結串列的首個節點被稱為“頭節點”,最後一個節點被稱為“尾節點”。 ‧ 尾節點指向的是“空”,它在 Java、C++ 和 Python 中分別被記為 null、nullptr 和 None 。 ‧ 在 C、C++、Go 和 Rust 等支持指標的語言中,上述“引用”應被替換為“指標”。 如以下程式碼所示,鏈結串列節點 ListNode 除了包含值,還需額外儲存一個引用(指標)。因此在相同資料 量下,鏈結串列比陣列佔用更多的記憶體空間。0 码力 | 392 页 | 18.83 MB | 10 月前3
Hello 算法 1.2.0 简体中文 C语言 版Hello 算法 C 语言版 作者:靳宇栋(@krahets) 代码审阅:宫兰景(@Gonglja) Release 1.2.0 2024‑12‑06 序 两年前,我在力扣上分享了“剑指 Offer”系列题解,受到了许多读者的鼓励和支持。在与读者交流期间,我 最常被问的一个问题是“如何入门算法”。逐渐地,我对这个问题产生了浓厚的兴趣。 两眼一抹黑地刷题似乎是最受欢迎的方法,简单、直接 ,那么本书可助你回顾与梳理算法知识体系,仓库源代码可 以当作“刷题工具库”或“算法字典”来使用。 若你是算法“大神”,我们期待收到你的宝贵建议,或者一起参与创作。 前置条件 你需要至少具备任一语言的编程基础,能够阅读和编写简单代码。 0.1.2 内容结构 本书的主要内容如图 0‑1 所示。 ‧ 复杂度分析:数据结构和算法的评价维度与方法。时间复杂度和空间复杂度的推算方法、常见类型、示 ‑tse、khoaxuantu、 krahets、night‑cruise、nuomi1、Reanon 和 rongyi 完成(按照首字母顺序排列)。感谢他们付出的时间 与精力,正是他们确保了各语言代码的规范与统一。 在本书的创作过程中,我得到了许多人的帮助。 ‧ 感谢我在公司的导师李汐博士,在一次畅谈中你鼓励我“快行动起来”,坚定了我写这本书的决心; ‧ 感谢我的女朋友泡泡作为本书的首0 码力 | 392 页 | 18.52 MB | 10 月前3
Data Structures That Make Video Games Go Round0 码力 | 196 页 | 3.03 MB | 6 月前3
Hello 算法 1.2.0 繁体中文 Go 版Hello 演算法 Go 語言版 作者:靳宇棟(@krahets) 程式碼審閱:劉代富(@Reanon) Release 1.2.0 2024‑12‑06 序 兩年前,我在力扣上分享了“劍指 Offer”系列題解,受到了許多讀者的鼓勵與支持。在與讀者交流期間,我 最常被問到的一個問題是“如何入門演算法”。漸漸地,我對這個問題產生了濃厚的興趣。 兩眼一抹黑地刷題似乎是最受歡迎的方法,簡 記錄。需要注意的是,Python 中 range(a, b) 對應的區間是“左閉右開”的,對應的走訪範圍為 ?, ? + 1, … , ? − 1 : // === File: iteration.go === /* for 迴圈 */ func forLoop(n int) int { res := 0 // 迴圈求和 1, 2, ..., n-1, n for i := 1; i <= 迴圈中,程式每輪都會先檢查條件,如果條 件為真,則繼續執行,否則就結束迴圈。 下面我們用 while 迴圈來實現求和 1 + 2 + ⋯ + ? : // === File: iteration.go === /* while 迴圈 */ func whileLoop(n int) int { res := 0 // 初始化條件變數 i := 1 // 迴圈求和 1, 2, ...,0 码力 | 385 页 | 18.80 MB | 10 月前3
Hello 算法 1.2.0 简体中文 Go 版Hello 算法 Go 语言版 作者:靳宇栋(@krahets) 代码审阅:刘代富(@Reanon) Release 1.2.0 2024‑12‑06 序 两年前,我在力扣上分享了“剑指 Offer”系列题解,受到了许多读者的鼓励和支持。在与读者交流期间,我 最常被问的一个问题是“如何入门算法”。逐渐地,我对这个问题产生了浓厚的兴趣。 两眼一抹黑地刷题似乎是最受欢迎的方法,简单、直接 ,那么本书可助你回顾与梳理算法知识体系,仓库源代码可 以当作“刷题工具库”或“算法字典”来使用。 若你是算法“大神”,我们期待收到你的宝贵建议,或者一起参与创作。 前置条件 你需要至少具备任一语言的编程基础,能够阅读和编写简单代码。 0.1.2 内容结构 本书的主要内容如图 0‑1 所示。 ‧ 复杂度分析:数据结构和算法的评价维度与方法。时间复杂度和空间复杂度的推算方法、常见类型、示 ‑tse、khoaxuantu、 krahets、night‑cruise、nuomi1、Reanon 和 rongyi 完成(按照首字母顺序排列)。感谢他们付出的时间 与精力,正是他们确保了各语言代码的规范与统一。 在本书的创作过程中,我得到了许多人的帮助。 ‧ 感谢我在公司的导师李汐博士,在一次畅谈中你鼓励我“快行动起来”,坚定了我写这本书的决心; ‧ 感谢我的女朋友泡泡作为本书的首0 码力 | 384 页 | 18.49 MB | 10 月前3
2.1.4 PingCAP Go runtime related problems in TiDB production environmentGo runtime related problems in TiDB production environment About me ● Arthur Mao(毛康力), Senior Engineer@PingCAP ● TiDB core developer (top3 contributor) ● GitBook about golang internals (@tiancaiamao) consider priority ● CPU dense workload could affect IO latency Conclusion Part II - Memory control ● Go Runtime ○ Allocated from OS (mmaped) ○ Managed Memory ■ Should the memory be returned to the OS? ○ memory footprint is abnormal ● The memory available on this node is not too much Description ● The Go Runtime thinks it does not use much memory ● The OS does not release the memory (RSS is high) Investigate0 码力 | 56 页 | 50.15 MB | 6 月前3
共 342 条
- 1
- 2
- 3
- 4
- 5
- 6
- 35













