A way to compile Firefox with all unused code paths clipped from the build?

Hello, I’m new to the forums. Is there some way to compile Firefox with only the features that I use?

For example, is it possible to somehow instrument all code paths, profile runtime usage based on a set of expected actions, then compile Firefox (or any program in general) with only the code paths that it ever touches?

Kind of like a JIT where you use firefox for a bit, and it updates it self, but cuts unused features?

Or like an installer that you choose from all of the features and it compiles only with features you asked for?

@andy_morris22 More like your JIT suggestion. I could run Firefox, then using some automated tests I could perform examples of user interaction on an app, then based on that would be able to compile Firefox with only the code paths that were used. In theory then the same tests would pass on trimmed version of the browser.