With 64 bit address spaces, thread stacks should have GBs reserved by default, and programming with alloca should be encouraged. A lot of string and container work could be done at high performance with alloca and no frees if you don't let them escape.
-
-
Replying to @ID_AA_Carmack
Having a per-thread temporary allocator that is a standard convention, so that everyone including libraries can use it, is better... you can return temporary strings / arrays / nodes from functions, etc. (I do this all the time in the language I am working on).
2 replies 1 retweet 72 likes -
Replying to @Jonathan_Blow @ID_AA_Carmack
You just pretend like you have a GC for all these things, and it just gets completely reset once per frame at a known point.
5 replies 0 retweets 50 likes -
Replying to @Jonathan_Blow @ID_AA_Carmack
We had this on one of the engines I worked on, a per frame linear buffer that would reset at a known time. It was shared among threads though, and it would be double buffered so GPU could access it on a different frame as well.
1 reply 0 retweets 5 likes -
Replying to @esmolikowski @ID_AA_Carmack
The problem with sharing across threads is that now it's a contended resource. Also the threads have to sync to reset it, but, if that is part of your design already then it is fine.
1 reply 0 retweets 7 likes -
Replying to @Jonathan_Blow @ID_AA_Carmack
It depends on how you use your threads I guess. That linear buffer was used for all the jobs and memory needed to be passed around between them. Jobs could also have their own local linear allocator. Long running threads would not use this memory.
1 reply 0 retweets 1 like -
Replying to @esmolikowski @ID_AA_Carmack
In my experience, if you are trying to make sure your cores are working all the time, you want to get rid of as many sync points as possible. Sync points around something common like allocation are death, threads will logjam there very quickly.
2 replies 0 retweets 5 likes -
But one may not notice this if one is not profiling threads with an eye to maximizing performance.
1 reply 0 retweets 4 likes
Passing memory between threads is annoying if the originating thread has to free it. But under this model, where nobody explicitly frees the memory (except the per-frame reset), there is no problem passing it between threads.
-
-
Replying to @Jonathan_Blow @ID_AA_Carmack
That’s the whole idea. That memory is transient and only lives for one frame. Allows to break your frame in many small jobs going wide, allowing you to much better balance your thread utilization. This is the model we used back on the PS3 with all the SPUs.
0 replies 0 retweets 1 likeThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.