Skip to content

Commit dae7079

Browse files
DinoVmeta-codesync[bot]
authored andcommitted
Improve _PyType_Lookup performance for ARM64
Summary: A small tweak to `_PyType_Lookup` to improve the situation on ARM to increasing the cache size - we have more memory per core on ARM so we should take advantage of it. This increases the used cache size from 96k to 384k. Reviewed By: itamaro Differential Revision: D111090602 fbshipit-source-id: ab725fb8c024326ddaf173b4115878be55747da1
1 parent a898446 commit dae7079

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Include/internal/pycore_typeobject.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ struct type_cache_entry {
3232
PyObject *value; // borrowed reference or NULL
3333
};
3434

35+
#if defined(__aarch64__)
36+
#define MCACHE_SIZE_EXP 14
37+
#else
3538
#define MCACHE_SIZE_EXP 12
39+
#endif
3640

3741
struct type_cache {
3842
struct type_cache_entry hashtable[1 << MCACHE_SIZE_EXP];

0 commit comments

Comments
 (0)