Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
tossaway32
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
4 ms
·
1.
▲
by
tossaway32
5y ago
How does Java do without using an array of ints, or Valhalla? In other words, what's the cost of Java's forced indirection? What happens if you use pool := make([]Tree, 0, 256) instead of var pool []Tree in the Go so
2.
▲
by
tossaway32
5y ago
Thanks for doing the test!
3.
▲
by
tossaway32
5y ago
Do it. Show me that Java can avoid allocating/collecting the Tree objects. Go has no indirection for the Tree objects, in this example. The Trees are contiguous in memory. Measure the performance. I have no garbage collection performan
4.
▲
by
tossaway32
5y ago
You don't rewrite your whole program to use pooled allocations. Just the parts of your program where allocation performance needs to be improved. If part of your program is doing many allocations, and it's too slow, use a simple p
5.
▲
by
tossaway32
5y ago
I'm not going to paste 170 lines of code into the thread. Add this line: var pool []Tree to each of the stretch and long-lived closures in run(), pass &pool as the second argument to bottomUpTree(), pass pool as the second a
6.
▲
by
tossaway32
5y ago
Look at the Go benchmark program: https://benchmarksgame-team.pages.debian.net/benchmarksgame/... Needs to be faster? Use a pool like the C benchmark programs, but super simple: just a slice, local to the goroutine. Tr