New GitHub issue #96459 from markshannon:<br>

<hr>

<pre>
The `_Py_Deepfreeze_Init()` function calls `_PyStaticCode_InternStrings` once for each string.

Creating the interned string dict in one go, from the table of static strings would be much faster.
something like this (error checking omitted, and other liberties taken for brevity)
```
_Py_CreateInternedDict(PyObject **strs, int n) {
   PyDictKeys *table = make_dict_keys(n);
   for (int i = 0; i < n; i++) {
        table->entries[i].key = table->entries[i].value = strs[i];
        table->entries[i].hashcode = strs[i].hash_code;
        // Fix up size and entries here.
   }
   return new_dict(table);
}
```
All the hash codes will need to be initialized first, but we probably should do that anyway.


</pre>

<hr>

<a href="https://github.com/python/cpython/issues/96459">View on GitHub</a>
<p>Labels: performance</p>
<p>Assignee: </p>