There is a profiler built into Emacs that will help:
https://www.gnu.org/software/emacs/manual/html_node/elisp/Pr...
https://www.emacswiki.org/emacs/EmacsNativeProfiler
Also, ESUP for profiling your startup time:
https://github.com/jschaf/esup
There's also a second profiler in Emacs, ELP, which can be used for testing individual functions: