MCPcopy Create free account

hub / github.com/Shitaibin/golang_step_by_step / functions

Functions617 in github.com/Shitaibin/golang_step_by_step

↓ 14 callersFunctionDoJob
var data [DataSize]int 计算密集型任务 限制Go routine的数量,完成并发任务
concurrent/cpucore/core_test.go:16
↓ 12 callersFunctionPipelineFan
(bufSize int)
golang_pipeline_step_by_step/buffer_size/hi_fan_buffered.go:74
↓ 7 callersFunctionsleep
()
gc/top_pprof/demo.go:38
↓ 7 callersFunctionsquare
(inCh <-chan int)
golang_pipeline_step_by_step/buffer_size/hi_fan_buffered.go:18
↓ 6 callersMethodAddPeer
(p *Peer)
first_class_function/host_v3/host/host.go:53
↓ 6 callersFunctionprintValue
使用Value.Interface()获取真实值并打印
reflect/law_of_reflect/to_interface.go:9
↓ 6 callersFunctionprintValue
使用Value.Kind()类型判断,并获取真实值进行打印
reflect/law_of_reflect/to_reflect.go:9
↓ 6 callersFunctionquickSortSlow
(nums []int, a, b int)
isort/sort_test.go:80
↓ 5 callersMethodAddPeer
(p *Peer)
first_class_function/host_v2/host/host.go:61
↓ 5 callersMethodAddPeer
(p *Peer)
first_class_function/host_v1/host/host.go:32
↓ 5 callersMethodDo
(f func())
problems/concurrent/once0.go:14
↓ 5 callersMethodGetPeer
GetPeer 当前Peer不存在时返回nil。
first_class_function/host_v3/host/host.go:78
↓ 5 callersMethodHello
(ctx context.Context, in *String, opts ...grpc.CallOption)
grpc/server/hello.pb.go:174
↓ 5 callersFunctionprintMemStats
(tag string)
gc/top_pprof/demo.go:42
↓ 4 callersMethodPut
(key, value int)
problems/concurrent/map1.go:17
↓ 4 callersFunctiondoTest
(addFunc func(*peer.Peer), rmFunc func(string), getFunc func(string) *peer.Peer)
sync_atomic/atomic_test.go:76
↓ 4 callersFunctiongenData
(n int)
isort/sort_test.go:239
↓ 4 callersFunctioninsertionSort
(nums []int, a, b int)
isort/sort_test.go:30
↓ 4 callersFunctiontest
(id int, done chan struct{}, n int, f func(chan int))
scheduler/gomaxprocs/simple.go:29
↓ 3 callersMethodGet
(key int)
problems/concurrent/map1.go:10
↓ 3 callersMethodGetPeer
GetPeer 当前Peer不存在时返回nil。
first_class_function/host_v2/host/host.go:74
↓ 3 callersMethodGetPeer
GetPeer 当前Peer不存在时返回nil。
first_class_function/host_v1/host/host.go:47
↓ 3 callersMethodQuery
Query 查询余额
sync_pkg/mutex.go:49
↓ 3 callersMethodRecv
()
grpc/server/hello.pb.go:206
↓ 3 callersMethodRemovePeer
(pid string)
first_class_function/host_v3/host/host.go:60
↓ 3 callersMethodSend
(*String)
grpc/server/hello.pb.go:205
↓ 3 callersMethodStart
()
sync_atomic/channel/host.go:21
↓ 3 callersMethodStart
()
first_class_function/host_v3/host/host.go:32
↓ 3 callersMethodStop
()
first_class_function/host_v3/host/host.go:36
↓ 3 callersMethodString
()
unsafe/cast.go:14
↓ 3 callersFunctionf
()
problems/concurrent/once/once1.go:78
↓ 3 callersFunctionproducer
(n int)
golang_pipeline_step_by_step/buffer_size/hi_fan_buffered.go:7
↓ 3 callersFunctionquickSortFast
sort range [a,b] func quickSortFast(nums []int, a, b int) { for a < b { pivot := doPivot(nums, a, b) if pivot-1 > a { quickSortFast(nums, a, p
isort/sort_test.go:61
↓ 3 callersFunctionreadData
(n int)
isort/sort_test.go:276
↓ 3 callersFunctionsquare
(inCh <-chan int)
golang_pipeline_step_by_step/hi_fan.go:20
↓ 3 callersFunctionsquare
(inCh <-chan int)
golang_pipeline_step_by_step/hi_fan_example.go:19
↓ 3 callersFunctionsquare
(inCh <-chan int)
golang_pipeline_step_by_step/optimize_fan_model/hi_fan.go:20
↓ 3 callersFunctionsquare
(inCh <-chan int)
golang_pipeline_step_by_step/optimize_fan_model/hi_fan_buffered.go:20
↓ 3 callersFunctionsquare
(inCh <-chan int)
golang_pipeline_step_by_step/optimize_fan_model/hi_fan_example.go:19
↓ 3 callersFunctionsquare
(inCh <-chan int)
golang_pipeline_step_by_step/master/hi_fan.go:20
↓ 3 callersFunctionsquare
(inCh <-chan int)
golang_pipeline_step_by_step/master/hi_fan_example.go:19
↓ 3 callersFunctionsquare
(inCh <-chan int)
golang_pipeline_step_by_step/fan_model_slow/hi_fan.go:20
↓ 3 callersFunctionsquare
(inCh <-chan int)
golang_pipeline_step_by_step/fan_model_slow/hi_fan_example.go:19
↓ 3 callersFunctionswap
go test -bench=. -benchmem ./... 样例函数 两种交互写法性能并无显著差别
benchmark/bechmark_test.go:9
↓ 2 callersMethodDeposit
Deposit 存款
sync_pkg/no_mutex.go:20
↓ 2 callersMethodDeposit
Deposit 存款
sync_pkg/mutex.go:22
↓ 2 callersMethodDeposit
Deposit 存款
sync_pkg/rwmutex.go:22
↓ 2 callersMethodDo
(op Operation)
first_class_function/03_high_order_func2_result.go:25
↓ 2 callersMethodDo
(op Operation, a int)
first_class_function/02_high_order_func1_param.go:19
↓ 2 callersFunctionEntrance
()
pprof/test/pprof_test.go:11
↓ 2 callersMethodGetValue
()
grpc/client/hello.pb.go:72
↓ 2 callersMethodGetValue
()
grpc/server/hello.pb.go:72
↓ 2 callersMethodHiStream
(ctx context.Context, opts ...grpc.CallOption)
grpc/server/hello.pb.go:175
↓ 2 callersMethodLen
()
problems/concurrent/map1.go:23
↓ 2 callersFunctionLockAndSleep
(mu *sync.Mutex, wg *sync.WaitGroup)
pprof/test/pprof_test.go:26
↓ 2 callersFunctionNewHost
()
first_class_function/host_v3/host/host.go:24
↓ 2 callersMethodQuery
Query 查询余额
sync_pkg/no_mutex.go:41
↓ 2 callersFunctionReadWithSelect
select结构实现通道读
channel/unblock_channel/select_timer_unblock.go:45
↓ 2 callersFunctionReadWithSelect
select结构实现通道读
channel/unblock_channel/select_unblock.go:44
↓ 2 callersMethodRemovePeer
(pid string)
first_class_function/host_v2/host/host.go:65
↓ 2 callersMethodRemovePeer
(pid string)
first_class_function/host_v1/host/host.go:39
↓ 2 callersMethodStart
()
first_class_function/host_v2/host/host.go:34
↓ 2 callersMethodStop
()
sync_atomic/channel/host.go:25
↓ 2 callersMethodStop
()
first_class_function/host_v2/host/host.go:38
↓ 2 callersMethodString
()
protobuf/helloworld1/types/request.pb.go:32
↓ 2 callersMethodString
()
protobuf/helloworld2/types/request.pb.go:31
↓ 2 callersFunctionWriteChWithSelect
select结构实现通道写
channel/unblock_channel/select_timer_unblock.go:85
↓ 2 callersFunctionWriteChWithSelect
select结构实现通道写
channel/unblock_channel/select_unblock.go:82
↓ 2 callersMethodWriteMsg
(msg string)
first_class_function/host_v3/host/host.go:12
↓ 2 callersFunctionchangeToSeven
Can not set, if you set a non-setability Value, it will panic
reflect/law_of_reflect/setable.go:52
↓ 2 callersFunctiondoPivot
doPivot returns the index of pivot`
isort/sort_test.go:91
↓ 2 callersFunctionempty
()
scheduler/preempt/demo3_normal.go:23
↓ 2 callersFunctionf
()
problems/concurrent/once0.go:40
↓ 2 callersFunctiongcBeforeUse
(p *Person)
sync_pkg/pool/pool_test.go:13
↓ 2 callersFunctiongenFileName
(n int)
isort/sort_test.go:298
↓ 2 callersFunctiongoMin
从testing/benchmark.go看到了这种奇怪的写法 逻辑上来讲,性能应没有差异。 测试结果也是如此。
minmax/benchmark_test.go:22
↓ 2 callersFunctionhandle
handle 处理请求,耗时随机模拟
channel/practice/demo.go:34
↓ 2 callersFunctioninsertionSortFast
conclusion: insertion sort fast ~= slow shell sort > insertion sort
isort/sort_test.go:18
↓ 2 callersFunctionmerge
(bufSize int, cs ...<-chan int)
golang_pipeline_step_by_step/buffer_size/hi_fan_buffered.go:30
↓ 2 callersFunctionmin
(x, y int)
minmax/benchmark_test.go:5
↓ 2 callersFunctionprocessRequest
(size int)
problems/concurrent/pool.go:34
↓ 2 callersFunctionshellSort
(nums []int, a, b int)
isort/sort_test.go:38
↓ 2 callersFunctionswapT
(i, j int)
benchmark/bechmark_test.go:13
↓ 2 callersFunctionwaitResp
waitResp 等待请求响应req, expVal是查询时使用的期待值
channel_plus_sync/channel_map.go:178
↓ 2 callersFunctionwaitTimer
()
pprof/timer/demo1_test.go:9
↓ 2 callersFunctionwrite
(name string)
file/multi-write/main.go:19
↓ 1 callersFunctionAdd
(b int)
first_class_function/03_high_order_func2_result.go:7
↓ 1 callersMethodBroadcastMsg
(msg string)
first_class_function/host_v2/host/host.go:69
↓ 1 callersMethodBroadcastMsg
(msg string)
first_class_function/host_v3/host/host.go:67
↓ 1 callersMethodBroadcastMsg
(msg string)
first_class_function/host_v1/host/host.go:54
↓ 1 callersFunctionDate2Time
()
date/main.go:8
↓ 1 callersMethodDeposit
Deposit 存款
channel_plus_sync/channel_map.go:81
↓ 1 callersMethodDo
(f func())
problems/concurrent/once/once1.go:13
↓ 1 callersMethodDoFast
(f func())
problems/concurrent/once/once1.go:38
↓ 1 callersMethodDoSlow
(f func())
problems/concurrent/once/once1.go:25
↓ 1 callersMethodGetTag
()
build_tag/interface.go:4
↓ 1 callersFunctionHello
()
gomod/hello.go:5
↓ 1 callersMethodHello
(ctx context.Context, in *String, opts ...grpc.CallOption)
grpc/client/hello.pb.go:174
↓ 1 callersMethodHiStream
(ctx context.Context, opts ...grpc.CallOption)
grpc/client/hello.pb.go:175
↓ 1 callersMethodLoop
Loop 银行处理客户请求
channel_plus_sync/channel_map.go:57
next →1–100 of 617, ranked by callers