Closed brancz closed 1 year ago
Thanks. I did this somewhat differently. I reused the existing NoTemplateParams
, making it work for the Rust demangler as well. I just dropped everything inside the <>. I applied it to "dyn" entries as well.
Let me know if you see any problems. Thanks.
I don't think I feel strongly, the only thing is that now we just get empty <>
, while previously we would at least see the number of type parameters taken.
Perf wise it seems identical:
$ benchstat without-types.txt without-types-no-template.txt
name old time/op new time/op delta
Rust-10 2.19µs ± 0% 2.23µs ± 0% +1.67% (p=0.008 n=5+5)
Yes, it seemed to me that <>
was clearer than <T>
. After all, there really could be a type T
. And if you don't care about the type parameters, why do you care exactly how many there are?
But I'm not a Rust programmer, so let me know if I'm mistaken.
Depending on the situation it may be too expensive to fully demangle a function name and all of its generic type parameters. In particular Rust very aggressively inlines and tries to make abstractions zero-cost, which can result in extreme nesting of generic type-parameters.
An example function name from a real life workload demonstrates this, for which a benchmark has been added. The difference of enabling/disabling the newly introduced mode is rather dramatic (even if expected since the mode intentionally does less).