Hacker News new | ask | show | jobs
by ccleve 328 days ago
The performance hit you take for doing dynamic dispatch is real and measurable. It's a no-go if you're in a performance sensitive part of your app.
2 comments

I write rust for no_std embedded devices and I just use stack_dst for this :)

Of course you‘re right if you can‘t alloc, you can‘t use Box or similar stuff.

Also you can avoid a lot of performance hits if you just implement most stuff on the dyn Trait directly!

Sure but most code paths are not hot. This is definitely premature optimization at the expense of everything else.