#90 ByteStreamer#append

Fechado
4 anos atrás foi aberto por ranides · 1 comentários

We could try to avoid allocating new array if there is enough space in current buffer.

Current "pending" fragment can be moved to the begin of the "array". New data could be copied after it.

In fact, it won't change almost anything except:

  • conditional allocation
  • storing additional field: "array_length" (which could be smaller than array.length)
We could try to avoid allocating new array if there is enough space in current buffer. Current "pending" fragment can be moved to the begin of the "array". New data could be copied after it. In fact, it won't change almost anything except: - conditional allocation - storing additional field: "array_length" (which could be smaller than array.length)
ranides comentado 4 anos atrás
Proprietário
this.array_size = pending + input.length;
byte[] appended = this.array_size > array.length ? new byte[alloc] : array;
``` this.array_size = pending + input.length; byte[] appended = this.array_size > array.length ? new byte[alloc] : array; ```
ranides citou este problema em um commit 3 anos atrás
Faça login para participar desta conversação.
Sem milestone
Não atribuída
1 participantes
Carregando...
Cancelar
Salvar
Ainda não há conteúdo.