Parsing logs in sed efficiently
Thanks to itsbruce this runs much faster:

sed -e "s,^.* DEBUG,$(tput setaf 2)&amp;$(tput sgr0)," \
    -e "s,^.* INFO,$(tput setaf 2)&amp;$(tput sgr0)," \
    -e "s,^.* WARN,$(tput setaf 3)&amp;$(tput sgr0)," \
    -e "s,^.* ERROR,$(tput setaf 1)&amp;$(tput sgr0)," \
    -e "s,^.* SEVERE,$(tput setaf 1)$(tput bold)&amp;$(tput sgr0),"


Note: first two and the last line are removed.

Since sed takes the STDIN, this basically starts one sed instance for whole stream in contrast to one per line.