Use tagged pointers for more efficient integer operations.
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Python
- Estrelas
- 77.2k
- Forks
- 36k
- Métricas de merge de PRs
- Métricas de PR pendentes
Descrição
Feature or enhancement
Proposal:
From the discourse discussion:
Integers are ubiquitous, both in Python code and the virtual machine.
However our representation of integers is somewhat clunky and inefficient.There is an old technique for handling ints efficiently in dynamic language VMs, called tagged pointers.
A normal object pointer always has its low bits set to zero, as objects are 8 or 16 byte aligned in memory.
We can use those low bits as “tags” to denote the meaning of the high bits.
Historically, the low bit has been set to zero to indicate that the high bits are a pointer, and to 1 to indicate that the high bits are an integer.We already use another tagging scheme within the interpreter and in the frame stack, the tag indicating whether the reference is borrowed.
I expect to start small with this, initially just fixing https://github.com/python/cpython/issues/132508 then improving the performance of iteration over lists and tuples.
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
https://discuss.python.org/t/using-tagged-pointers-to-support-efficient-integer-operations/87950
Linked PRs
- gh-157353
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece lendo a issue #132508, o pull request vinculado #157353 e a discussão referenciada no Discourse para entender a representação proposta de ponteiros marcados e o trabalho atual. A issue não nomeia arquivos, testes ou uma tarefa de implementação com escopo delimitado; concluí-la exigiria definir e validar um design mais amplo do interpretador e da VM.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- python
- Domínio
- compilers
- Tipo de issue
- Funcionalidade
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Status de atividade
- Estagnada
- Clareza
- Precisa de esclarecimento
- Facilidade para iniciantes
- 20/100