Rooting is not for the faint of heart. By doing so you void your warranty. If you aren't careful, you can render your device useless.
Am I trying to convince you to not do it or scare you? No. I am trying to fully inform you of the implied course of action. I would read as much as you can about root and how to do so with your device. The M8 needs to have the bootloader unlocked, and that will wipe the device from everything.
Some reading material:
A little dated, but still vaild: Rooting - is it for me? Some Q&A | Android Central
Newest article by Jerry: There is no magic in root | Android Central
If you are interested in rooting I can try to help you out as much as I can.
Wakelock is a root only app.
i'd only like to use the xposed framework to add on feature which is to enable 2G only when screen off! shame.the network may or may not kill the battery