HackerTrans
热门最新趋势评论往期问答秀出招聘

gebdev

no profile record

提交

The Thirty Million Line Problem (2019) [video]

youtube.com
1 分·作者 gebdev·4个月前·0 评论

Improper Hierarchy (2018) [video]

deconstructconf.com
2 分·作者 gebdev·7个月前·0 评论

Pathological PATH

gebdev.net
5 分·作者 gebdev·8个月前·0 评论

A Day at the Park (2013)

kiriakakis.net
1 分·作者 gebdev·8个月前·0 评论

评论

gebdev
·7个月前·讨论
Loved this article. It showed how lacking my knowledge is in how operating systems implement concurrency primitives. It motivated me to do a bunch of research and learn more.

Notably the claim about how atomic operations clear the cache line in every cpu. Wow! Shared data can really be a performance limitation.
gebdev
·7个月前·讨论
> My experience with arenas is that they increase performance at the cost of a little extra memory usage.

ack, thanks! You’re exactly right, I got my words mixed up.
gebdev
·8个月前·讨论
This article is really well written. I like how it defines a new concept (bughouse chess), then uses it to help describe an emotion they’ve been feeling wrt more popular culture.

I also think bughouse seems cool (aside from the issues mentioned), and want to give it a shot now. Probably in-person.
gebdev
·8个月前·讨论
This is a great example of how ADTs can be implemented in C by emulating classes, despite the loss in brevity.

For the first item on reference counting, batched memory management is a possible alternative that still fits the C style. The use of something like an arena allocator approximates a memory lifetime, which can be a powerful safety tool. When you free the allocator, all pages are freed at once. Not only is this less error prone, but it can decrease performance. There’s no need to allocate and free each reference counted pointer, nor store reference counts, when one can free the entire allocator after argument parsing is done.

This also decreases fallible error handling: The callee doesn’t need to free anything because the allocator is owned by the caller.

Of course, the use of allocators does not make sense in every setting, but for common lifetimes such as: once per frame, the length of a specific algorithm, or even application scope, it’s an awesome tool!