Deleting the envelope index files and reindexing the messages did not help in my case. 6 hours later, CPU usage by Mail is still at 100% - independently of whether there is a network connection or not. With network connection the activity window provides no indication that Gmail/IMAP folders are repeatedly synchronized. There is also no indication that spotlight is updating index files, as md* processes are close to 0 % CPU usage.
Sampling the Mail process for 3 seconds with 1 millisecond of run time between samples (1984 samples in total), shows where the time is used:
1984 RunCurrentEventLoopInMode (in HIToolbox) + 226 [0x7fff8c04af0d]
1984 CFRunLoopRunSpecific (in CoreFoundation) + 309 [0x7fff88895275]
1607 __CFRunLoopRun (in CoreFoundation) + 1525 [0x7fff88895aa5]
! 1607 __CFRunLoopDoTimers (in CoreFoundation) + 298 [0x7fff8894b76a]
! 1607 __CFRunLoopDoTimer (in CoreFoundation) + 1151 [0x7fff888da25f]
! 1607 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ (in CoreFoundation) + 20 [0x7fff888da724]
! 1603 __NSFireDelayedPerform (in Foundation) + 333 [0x7fff8ea07c57]
! : 1124 ??? (in Mail) load address 0x106003000 + 0x8c7f2 [0x10608f7f2]
! : | 944 ??? (in Mail) load address 0x106003000 + 0x8d5e4 [0x1060905e4]
! : | + 431 ??? (in Mail) load address 0x106003000 + 0x17d31b [0x10618031b]
! : | + ! 424 ??? (in Mail) load address 0x106003000 + 0xdaa83 [0x1060dda83]
! : | + ! : 424 ??? (in Mail) load address 0x106003000 + 0xdad6b [0x1060ddd6b]
! : | + ! : 85 ??? (in Mail) load address 0x106003000 + 0xdafc1 [0x1060ddfc1]
I'm afraid there is no other option than hoping for further bugfixes from Apple...
It is a great shame that Apple's quality control did not discover the severe errors in an application that is so important for many customers. Did Apple's business administration, while pushing for quick solutions, prevail against engineers? Well-known high-tech companies have perished from this (epidemic) disease.