or whatever, but then I have to remember to do this every time. I also know that I can do this on a given account on a given computer by editing ~/.cargo/config to contain
but then another account won't be using this option, or another computer (e.g. belonging to one of my students). I'd love to hear if there is a relatively fool-proof way to ensure that my code will always be run with native instructions (which not infrequently gives a 10% speed boost).
I think that would be equivalent to using ~/.cargo, but it does make me think that I could cover students using my computers but editing /etc/bash/bashrc or something. But it still doesn't cover any other computers.
You can use a .cargo/configinside your project directory, though there are currently some caveats to be aware of, which can cause Cargo to ignore such config files in some cases.
A more foolproof solution might be to use dynamic CPU feature detection. This will work even when the program is built on one computer and run on another. It would also let you distribute pre-compiled binaries that support older CPUs without losing performance on newer ones.