I'm taking a course in compilers at my uni and in the section in lexing it mentions that there are several ways to construct a lexer, one being using a lexer generator and the other using regular expressions by hand. I'm personally more interested in trying to build something from scratch rather than using a generator, so using regular expressions seems like the option for me. However, it also mentioned that regular expressions are slow, and so in industrial compilers like GCC or Clang, these would not be used.
My question then is what method do compilers that prioritize speed use for constructing lexers, if not regular expressions? And furthermore, how realistic would it be to use this same method myself for lexing a simple language (not one intended for actual use)?