golangadvance's People
Forkers
ctkai01 toannhu96 daongoc315 chungpv ajackti tungdd97 phucle2411 leductoanuit bronstein0x113c1c3 nakunxuanviet quanhieu rabbit-onchain phunguyen-ph donhuvy quandat10 tranphuquy19 dieptran43 viktorngo congvosoftyn mrtonyhuynh minhcanh198 glucozo192 ngminhdan vanvuong1507 jimnguyendev php1301 moongj duyhung8a2 nguyenquocdung31072001 lemanhmaster bacnghg duongkhang042001 hoangcn95 zeromsi apollorisky tuanden0 hermag locbv jackbaron duynguyen27091997 chrisnguyen24 phatvu1301 quangtran9kz thiennl c3dr1cn dotrongnhan huydevct hadanhtuan irisvn phongdh29 dunglp diemquynhtran truongnat tainnsre tainguyenbp phuong39 binhbo12456 zuno90 tran-the-lam lekhanh-dev daolq-2712 lhnguyen4748 huuhieunguyen songtoan93 dotnet-reference dinhcanh303 thong2802golangadvance's Issues
Avoiding string to bytes conversion example is wrong.
At b85fa2d, in this file, both BenchmarkBad
and BenchmarkGood
causes []byte("Hello world")
escape to heap:
$ go test -c -gcflags=-m p_test.go
# command-line-arguments [command-line-arguments.test]
./p_test.go:8:19: b does not escape
./p_test.go:11:14: ([]byte)("Hello world") escapes to heap
./p_test.go:14:13: ... argument does not escape
./p_test.go:14:14: a escapes to heap
./p_test.go:17:20: b does not escape
./p_test.go:19:17: ([]byte)("Hello world") escapes to heap
./p_test.go:23:13: ... argument does not escape
./p_test.go:23:14: a escapes to heap
# command-line-arguments.test
_testmain.go:39:6: can inline init.0
_testmain.go:47:24: inlining call to testing.MainStart
_testmain.go:47:42: testdeps.TestDeps{} escapes to heap
_testmain.go:47:24: &testing.M{...} escapes to heap
The reason BenchmarkBad
is worse because the escaping happens inside the loop, it does not relate to string to bytes conversion operation.
Inheritance in Golang
In here: Inheritance , you said:
Golang has a flexible and powerful inheritance approach
I think writing like that would be easy to misunderstand. Go doesn’t have inheritance – instead composition. The implementations may look the same, but the concepts are totally different.
However, Inheritance Is Evil. Stop Using It. I think that why Go doesn't have inheritance. And I suggest limited use of Inheritance in the real projects in any language if possible.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.