Giter Club home page Giter Club logo

golab's Introduction

Golang Laboratory License Build Status

CPU与缓存基础训练

1. 运行 github.com/rbee3u/golab/baseline/simple/main.go,查看运行结果。
   目标:记住这种情况下每秒大概可以执行多少条指令,并且能知道具体的原因。
   提示:CPU架构、CPU和Core(核)的区别、什么是时钟频率、什么是CPU主频。

2. 运行 github.com/rbee3u/golab/baseline/memory/main.go,查看运行结果。
   目标:记住这种情况下每秒大概可以执行多少条指令,并且能知道具体的原因。
   提示:CPU缓存、L1、L2、L3分别的大小、程序运行时访问它们的具体速度。

3. 运行 github.com/rbee3u/golab/baseline/atomic/main.go,查看运行结果。
   目标:记住这种情况下每秒大概可以执行多少条指令,并且能知道具体的原因。
   提示:内存顺序(Memory Order)、CPU缓存一致性、内存屏障、Golang的atomic实现。

4. 运行 github.com/rbee3u/golab/baseline/lock/main.go,查看运行结果。
   目标:记住这种情况下每秒大概可以执行多少条指令,并且能知道具体的原因。
   提示:内存顺序(Memory Order)、CPU缓存一致性、内存屏障、Golang的lock实现。

CPU与缓存进阶训练

1. 运行 github.com/rbee3u/golab/parallel_optimization/main.go,查看运行结果。
   目标:fast比slow大致快多少,分析背后的原因。
   提示:并行与并发的区别,哪个才可以真正加速程序。

2. 运行 github.com/rbee3u/golab/instruction_pipeline/main.go,查看运行结果。
   目标:fast比slow大致快多少,分析背后的原因。
   提示:什么是指令流水线,什么情况下具有较好的加速效果。

3. 运行 github.com/rbee3u/golab/branch_prediction/main.go,查看运行结果。
   目标:fast比slow大致快多少,分析背后的原因。
   提示:分支预测,它和指令流水线有什么联系。

4. 运行 github.com/rbee3u/golab/spatial_locality/main.go,查看运行结果。
   目标:fast比slow大致快多少,分析背后的原因。
   提示:CPU缓存,程序的局部性原理。

5. 运行 github.com/rbee3u/golab/false_sharing/main.go,查看运行结果。
   目标:fast比slow大致快多少,分析背后的原因。
   提示:CPU缓存,内存屏障,False Sharing。

6. 运行 github.com/rbee3u/golab/lock_sharding/main.go,查看运行结果。
   目标:fast比slow大致快多少,分析背后的原因。
   提示:CPU缓存,内存屏障,分片为什么能够加速,背后的概率学原理是什么。

7. 运行 github.com/rbee3u/golab/bounds_check_elimination/main.go,查看运行结果。
   目标:fast比slow大致快多少,分析背后的原因。
   提示:Bounds Check Elimination,Golang代码如何生成汇编,如何分析汇编得出结论。

golab's People

Contributors

rbee3u avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.