Investigate enabling sized deallocation |
||
Issue description
Apparently -fsized-deallocation can help with allocation performance. gcc enables this by default with -std=c++14, but clang doesn't (and we only pass -std=c++11 anyhow).
This probably isn't possible on all platforms since not all standard libraries will have the sized overload, but it's possible on platforms where we control which standard lib is being used (Android, and currently OS X, but we might undo that again). I don't know if MSVS2015's standard library contains these already.
Also, if we placement new anywhere so that the dynamic size of a type doesn't match its static type, things won't work. We might do this in v8.
So maybe more trouble than it's worth, but we should check.
Demo:
$ cat test.cc
struct A {};
int main() {
delete new A;
}
$ clang -c test.cc -S -emit-llvm -o - | grep Pv
call void @_ZdlPv(i8* %1) #4
declare void @_ZdlPv(i8*) #2
$ clang -fsized-deallocation -c test.cc -S -emit-llvm -o - | grep Pv
call void @_ZdlPvm(i8* %1, i64 1) #4
declare void @_ZdlPvm(i8*, i64) #2
Note how the size of the object is passed to delete in the second example.
,
Mar 16 2016
Erratas (I am writing too many emails today): *to speed up the bucket *lookup* * 400K malloc / second -> most of these are actually c++ new-s
,
Mar 17 2016
we explicitly pass '/Zc:sizedDealloc-' to cl.exe due to bug 526851 at the moment.
,
Dec 12 2016
Bruce reports in https://codereview.chromium.org/2552623002/ that /Zc:sizedDealloc- saves us a quarter MB of code on Windows (!) So we might want to not turn this on after all.
,
Dec 13 2016
On the official Windows builds (everything except PGO) the cost of enabling sizedDealloc is only 190 KB. But still, that's annoying. So, we can enable this feature if we need it, but there is some cost.
,
Jan 10
Archiving issues older than 2 years with no owner or component. |
||
►
Sign in to add a comment |
||
Comment 1 by primiano@chromium.org
, Mar 16 2016