<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58860>58860</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Poor performance with hashing large constant strings
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
clubby789
</td>
</tr>
</table>
<pre>
Found as part of https://github.com/rust-lang/rust/pull/103812.
When creating a very large constant blob, a large proportion of compile time is spent hashing the string with `djbHash` to insert it into `CDSConstants` https://github.com/llvm/llvm-project/blob/244331ae833aaf33503bbd36890e704afb66a237/llvm/lib/IR/Constants.cpp#L2877-L2880
```llvm
@alloc = private unnamed_addr constant <{ [104857600 x i8] }> <{ [104857600 x i8] c"... VERY LONG DATA ..." }>, align 1
```
cc @pcwalton
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVUlFv3CAM_jXkxWpEIBeShzxc79ptUrVN3bRpTxMQklBxIQLSrv9-zqXtqj5UmmTZxgb7sz-U7x7ba79MHcgIswwJfA9jSnMkfE_YNcpg07ioXPsTHsIS04WT0_Dko5kX59AUlNcFywk9Errf9M_RTKCDkclOA0i4N-ERnAyDAe2nmOSUQDmvCDtgdkvMwc8-JOunFQk2na0zkOzJgI0QZ4NvRhnHtWIaDcQUVvcBQQKpaHenPmIWPUge7BQNjmRRJjxi9HD8dnhqHddL74zq3P2zuUBUd0av0254r1lZcl5IU3MuZc_5jnKlOl7VDTWClrJXVSUZF6_q2PXdp1tULwhyPc-E8RtWC3GBuqav14f4NjlX2EIllc55DYQfcVX2XiYDyzTJk-l-y64L_xZL-IGISyC7y4KW9U5UlMIfsDXZHYGII-FX717RhLE8z-HH1e0vuPny-QMc99_3gCFMPBU48-bsMEHxBvHrMTSiLemsH6RLyGpm2qKqRF2VBadZ1_Ku4Y3Mkk3OtF-9DzCb0PtwkpM2G6_PfL_5Ohv1MVuCa_-bRxvjYiI6u7quaDa2ja541fesM1T1TWEKoxnbSdr1yHXNReakMi62uC3cT2ZbRhkrCioYss9priTvuNDCdFLwRlCc2ZykdfnaOPdhyEJ7xqCWIWLS2Ygf4CUpY8RFGvNcXy5p9KHVblHqUdRNdgbcntH-BRrVI5U">