<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/57117>57117</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-format 14 is extremely slow
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
manxorist
</td>
</tr>
</table>
<pre>
Formatting https://github.com/OpenMPT/openmpt/blob/072d4ccc83d842cfa34601dddf2c69a4cc889c74/src/mpt/arch/x86_amd64.hpp (~50kB) using https://github.com/OpenMPT/openmpt/blob/072d4ccc83d842cfa34601dddf2c69a4cc889c74/src/mpt/.clang-format with clang-format 14 takes about 14 minutes for me (CPU is a 3.4GHz AMD Piledriver).
I am using `clang-format version 14.0.5` (as shipped with Visual Studio 2022 17.3.0) or `Ubuntu clang-format version 14.0.6-++20220622053131+f28c006a5895-1~exp1~20220622173215.157` (from `deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main`).
I do not see any excessive memory consumption, it's only CPU time.
The performance was fine with clang-format 13.
I could also provide other source files where performance is noticeably slow with clang-format 14 if required, however the given file is the worst offender.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy9U02TnDgM_TVwUTVlDBg4cJhkNskeUpmqfFxTxhaNN8ZmbTM9k18fQTpJTTabY6qali3L0tN78uj14_DCh0WmZNwZ5pTWmFU3GX9Bv7NJ8zYWyi-0ebOie333jlaeVsuaaDVaP5JhLde1UqqrdFdzNcmqFqzUWk9ciV7SUdf1qq0pNAZF_19vy6BmMg-d-CgXLepiXlfIeJe1fzXs07OM97DFP46qUFa682k6SIELFYMnnrKGJD9hBDn67dguxm2JHBQAC-4dPL97D4YioCrql68-w83rW7gzFnUw9xiosSJjtxm7-Rvkcu0xE-xJGYqLxjvKX7CiodM9r4wQZ7OuqL8C-2DiJi28TZs2HjjjHMq2qAq2c0do6Nr7cXNpg__PLU4ZJ66f7beZoK-pyqokx8Q7xZiQTdc3p5JEwYd1N98Cy7biZVOUTXtFNwW_7CU1jodk3xWTayqsvV8KH860nbySlizsvlPy3qpZGnc6_KedUNpRnh88fWNLe3A-QUQE6R4BHxTGSJQS7YsPj6C8ixvJSM1l_DkY0rON4J19hF2SZBZ8kvHdjLBiOGhxCuFCBE_G4a9kr37CovxmNUgbPazB3xuN4NOMAaLfAuWaSO8IF_I8rUFzQT0YhXIkWNH6y6-HzEwQ8N_NBNR7L7O_IOkGVALO1LI7CuzZds_Fh5jATxM6jeGKNMehFILxvutbnuuh0n3VyzyZZHH4T7lIdKaAC15R5Vuww29e3i7e1ZyIgH9Q7a_HxLhhpEXTlmWbzwP209g2rOF92wpBT7HBsdaq6rjgqudTbuWINg5ZQ0PIHV7gSEHrrLnNzXBMW1fykrG-4sXYStGLalS6nASKMasZ0rjY7_OVh-GANG7nSIfWxBR_HEoal7NDPMpRfrml2YeBlHnwgULzo_hwgP8C4J2edA">