Imagine that there's an mitzvah which I can do. It might be obligatory, or it might not be. For example, tefillin, prayer, kiddush, havdalah, shofar, feeding my pet, visiting the sick, Torah study, or something else.
May I do other activities beforehand? For example, shaving, showering, working, reading the newspaper, checking my email, drinking some water, or something else.
Also, what if it's too early for me to do the mitzvah, but the time when I can start the mitzvah is coming soon?
Is it affected by whether I have the right intentions in mind before I start the other activity?
Note: I am defining the term "mitzvah" broadly, to include other actions like paid computer consulting. That might also be a mitzvah (chesed / kindness). See Reward Miles to Heaven by Rabbi Shlomo Schwartz. Or see page 27 of An Offer You Can't Refuse by Rabbi Yissocher Frand, which includes material based on a parable from the mashgiach of the Grodno yeshiva.