Pure-D / workspace-d

CLI deprecated, API + functionality moved into https://github.com/Pure-D/serve-d
MIT License
75 stars 15 forks source link

Reuse rollback allocators between calls in some places #103

Closed dayllenger closed 4 years ago

dayllenger commented 4 years ago

Explodes with the current libdparse dependency.

WebFreak001 commented 4 years ago

I think I liked the other approach more (destroy on struct destructor) which was also less error prone

dayllenger commented 4 years ago

Well this code should be kinda faster, because e.g. insertCodeInContainer may use the hot memory after calling getCodeBlockRange.

WebFreak001 commented 4 years ago

we set a checkpoint after (hopefully) no memory here so when we rollback it's going to run identical code to what is in the destructor right now.

With this change there is risk for wrong usage, leaking memory in it.

However there might be an advantage if we allocate 1 byte at the start and always roll back to 1 byte because then it will actually keep the memory of the first page allocated. For this we need to do a proper benchmark though.

dayllenger commented 4 years ago

Damn, this is true. I thought (for whatever reason) that it will keep the last used page even if it's empty (edit: well, it keeps but not the very first one). I don't know how to correctly benchmark this project, so I'll pass.

dayllenger commented 4 years ago

Anyway.