[PATCH] D17792: Initialize much of AssemblyWriter lazily.
Justin Lebar via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 31 16:51:32 PDT 2016
jlebar added inline comments.
================
Comment at: lib/IR/AsmWriter.cpp:82
@@ +81,3 @@
+
+ std::function<T()> Initializer;
+ Optional<T> Obj;
----------------
timshen wrote:
> Man, by last time I looked at libstdc++, it's like 48 bytes on 64-bit machines...
>
> Even if Lazy keeps track of the raw lambda, the lambda may still capture stuff and have memory footprint.
>
> Now I think it's a bad idea. It's as bad as that dtor doesn't have parameters so each container, which may be in a parent container, needs to keep its allocator.
>
> Sorry, I think the Optional version is better. :(
>
> BTW, how hard is it to make the user side lazy, rather the library side?
> Man, by last time I looked at libstdc++, it's like 48 bytes on 64-bit machines...
Eh, I don't think this is a big deal, compared to all the other work we're doing here. :)
> Even if Lazy keeps track of the raw lambda, the lambda may still capture stuff and have memory footprint.
Indeed, but these lambdas don't, so we're ok in that respect!
> It's as bad as that dtor doesn't have parameters so each container, which may be in a parent container, needs to keep its allocator.
:) Here I'm much more concerned about readability. Like, we're making this *way* faster in any case; the extra few bytes or whatever isn't a big deal.
> BTW, how hard is it to make the user side lazy, rather the library side?
I'm not sure what you mean; can you give me an example?
http://reviews.llvm.org/D17792
More information about the llvm-commits
mailing list