Re: Is realloc() between bucket sizes worthwhile with jemalloc?

2018-04-10 Thread Simon Sapin
On 09/04/18 13:58, Henri Sivonen wrote: Specifically, is it actually useful that nsStringBuffer uses realloc() as opposed to malloc(), memcpy() with actually semantically filled amount and free()? Upon superficial code reading, it seems to me that currently changing the capacity of an nsA[C]STri

Re: Is realloc() between bucket sizes worthwhile with jemalloc?

2018-04-09 Thread Henri Sivonen
On Mon, Apr 9, 2018 at 10:30 PM, Eric Rahm wrote: >> Upon superficial code reading, it seems to me that currently changing >> the capacity of an nsA[C]STring might uselessly use realloc to copy >> data that's not semantically live data from the string's point of view >> and wouldn't really need to

Re: Is realloc() between bucket sizes worthwhile with jemalloc?

2018-04-09 Thread Eric Rahm
On Mon, Apr 9, 2018 at 4:58 AM, Henri Sivonen wrote: > My understanding is that under some "huge" size, jemalloc returns > allocations from particularly-sized buckets. > The mozjemalloc source has a decent ascii-art table [1]. > This makes me expect that realloc() between bucket sizes is going

Is realloc() between bucket sizes worthwhile with jemalloc?

2018-04-09 Thread Henri Sivonen
My understanding is that under some "huge" size, jemalloc returns allocations from particularly-sized buckets. This makes me expect that realloc() between bucket sizes is going to always copy the data instead of just adjusting allocated metadata, because to do otherwise would mess up the bucketing