diff --git a/README.md b/README.md index e713be0..5cdf0c7 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ## Table of Content -- [Changkun Ou. Pointer Type May Not Be Ideal for Parameters. Oct 27, 2020.](./pointer-params.md) +- [Changkun Ou. Pointers Might Not Be Ideal for Parameters. Oct 27, 2020.](./pointer-params.md) - [Changkun Ou. Eliminating A Source of Measurement Errors in Benchmarks. Sep 30, 2020.](./bench-time.md) ## License diff --git a/pointer-params.md b/pointer-params.md index 20dd722..111f826 100644 --- a/pointer-params.md +++ b/pointer-params.md @@ -1,4 +1,4 @@ -# Pointer Type May Not Be Ideal for Parameters +# Pointers Might Not Be Ideal for Parameters Author(s): [Changkun Ou](https://changkun.de) @@ -209,9 +209,9 @@ The dumped assumbly code is as follows: The `addv` implementation uses values from the previous stack frame and writes the result directly to the return; whereas `addp` needs MOVQ that -copies the parameter to different registers (e.g., copy pointers to AX and CX,), -then write back when returning. Therefore, another unexpected cost in -`addp` is caused by the indirect addressing mode for accessing the memory unit. +copies the parameter to different registers (e.g., copy pointers to AX and CX), +then write back when returning. Therefore, with inline disabled, the reason that `addv` +is slower than `addp` is caused by different memory access pattern. ## Further Reading Suggestions diff --git a/pointer-params/Makefile b/pointer-params/Makefile index 8072f07..6d798fc 100644 --- a/pointer-params/Makefile +++ b/pointer-params/Makefile @@ -2,5 +2,5 @@ GOVERSION=$(shell go version | awk '{print $$3}') all: perflock -governor 80% go test -v -run=none -bench=. -count=10 | tee $(GOVERSION).txt benchstat $(GOVERSION).txt -asm: - mkdir asm && go tool compile -S vec.go > asm/vec.s \ No newline at end of file +assembly: + go tool compile -S vec.go > asm/vec.s