|
2025-04-13
| ||
| 22:27 | • Ticket [236d18f49b] More efficient Tcl_FindHashEntry() status still Open wit... artifact: 4964500130 user: jan.nijtmans | |
|
2025-04-12
| ||
| 03:17 | • Ticket [236d18f49b]: 3 changes artifact: d12628950d user: apnadkarni | |
|
2025-04-11
| ||
| 10:36 | Fix [236d18f49b]: More efficient Tcl_FindHashEntry() check-in: 5fd5d044bd user: jan.nijtmans tags: tkt-236d18f49b | |
| 10:32 | • New ticket [236d18f49b] More efficient Tcl_FindHashEntry(). artifact: a6e5e4c802 user: jan.nijtmans | |
More efficient Tcl_FindHashEntry()
#define Tcl_FindHashEntry(tablePtr, key) \
(*((tablePtr)->findProc))(tablePtr, (const char *)(key))
while the findProc is implemented as:
static Tcl_HashEntry *
FindHashEntry(
Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */
const char *key) /* Key to use to find matching entry. */
{
return CreateHashEntry(tablePtr, key, NULL);
}
This means we can do better. Why not just call the createProc directly with it's last NULL parameter (which means don't create anything)
This also means that findProc is not used any more, and could be removed altogether. Only .. we cannot remove it yet, because it might be used by Tcl 9.0-compiled extensions.
Since the Tcl_HashTable content is not documented, this is 100% upwards and downwards compatible.
5fd5d044bdFix [236d18f49b]: More efficient Tcl_FindHashEntry() check-in2025-04-11 10:36:16
Will this patch not preclude possible future internal implementation changes where find is no longer implemented through create?
Looking at generated code, it saves one jump. Not sure it is worth precluding future changes, however unlikely they might be. IMO.
Implementation is complete now. My goal was two things:
- Allow the newPtr value to be NULL, meaning "I'm not interested in this" - Implement Tcl_AttemptCreateHashEntry() (in a separate branch)
The second addition means that a TIP needs to be written anyway, so I an put this improvement in it as well.