October 31, 2013
Am Thu, 31 Oct 2013 10:42:35 +0100
schrieb "Namespace" <rswhite4@googlemail.com>:

> On Thursday, 31 October 2013 at 09:27:11 UTC, bearophile wrote:
> > In Python if you append items to an array, it sovra-allocates,
> Never heard of 'sovra'. What does it mean?

That's bearophilian for 'over'. :p

-- 
Marco

October 31, 2013
On 10/31/2013 01:10 PM, Marco Leise wrote:
> Am Thu, 31 Oct 2013 10:42:35 +0100
> schrieb "Namespace" <rswhite4@googlemail.com>:
>
>> On Thursday, 31 October 2013 at 09:27:11 UTC, bearophile wrote:
>>> In Python if you append items to an array, it sovra-allocates,
>> Never heard of 'sovra'. What does it mean?
>
> That's bearophilian for 'over'. :p

Apparently, a variation of Italian prefix sopra- :)

  http://en.wiktionary.org/wiki/sopra-

Ali

October 31, 2013
On Thu, Oct 31, 2013 at 01:28:13PM -0700, Ali Çehreli wrote:
> On 10/31/2013 01:10 PM, Marco Leise wrote:
> >Am Thu, 31 Oct 2013 10:42:35 +0100
> >schrieb "Namespace" <rswhite4@googlemail.com>:
> >
> >>On Thursday, 31 October 2013 at 09:27:11 UTC, bearophile wrote:
> >>>In Python if you append items to an array, it sovra-allocates,
> >>Never heard of 'sovra'. What does it mean?
> >
> >That's bearophilian for 'over'. :p
> 
> Apparently, a variation of Italian prefix sopra- :)
> 
>   http://en.wiktionary.org/wiki/sopra-
[...]

http://en.wiktionary.org/wiki/sovra

:)


T

-- 
Nearly all men can stand adversity, but if you want to test a man's character, give him power. -- Abraham Lincoln
October 31, 2013
On Thursday, 31 October 2013 at 09:53:39 UTC, Jonathan M Davis wrote:
> On Thursday, October 31, 2013 10:15:51 Namespace wrote:
>> I'm sure we had already this conversation but I don't find the
>> thread.
>> 
>> T[] buffer = new T[N]; assumes more space than stated (in average
>> 2010 elements more. See: http://dpaste.dzfl.pl/af92ad22c). It
>> behaves exactly like reserve and that is IMO wrong. If I reserve
>> memory with buffer.reserve(N), I want to have at least N
>> elements. That behaviour is correct. But if I use new T[N] I
>> mostly want exactly N elements and no extra space.
>> 
>> Thoughts?
>
> You're making the assumption that it would be normal to not want to then
> append to something you allocated with new T[N], and I don't think that that's
> a valid assumption.

I disagree. If I want to append I use reserve and I think that is the most common approach.
October 31, 2013
On Thursday, October 31, 2013 23:06:22 Namespace wrote:
> On Thursday, 31 October 2013 at 09:53:39 UTC, Jonathan M Davis
> 
> wrote:
> > On Thursday, October 31, 2013 10:15:51 Namespace wrote:
> >> I'm sure we had already this conversation but I don't find the thread.
> >> 
> >> T[] buffer = new T[N]; assumes more space than stated (in
> >> average
> >> 2010 elements more. See: http://dpaste.dzfl.pl/af92ad22c). It
> >> behaves exactly like reserve and that is IMO wrong. If I
> >> reserve
> >> memory with buffer.reserve(N), I want to have at least N
> >> elements. That behaviour is correct. But if I use new T[N] I
> >> mostly want exactly N elements and no extra space.
> >> 
> >> Thoughts?
> > 
> > You're making the assumption that it would be normal to not
> > want to then
> > append to something you allocated with new T[N], and I don't
> > think that that's
> > a valid assumption.
> 
> I disagree. If I want to append I use reserve and I think that is the most common approach.

I would fully expect that most people don't bother with reserve or capacity and that they simply create the array at whatever size they create it at and then append to it without worrying about reserve. But we'd have to get real data on that to know for sure one way or the other.

Certainly, most folks who are focusing on append performance seem to use Appender, and for the most part, I would suggest that anyone using reserve should be using Appender instead.

- Jonathan M Davis
November 01, 2013
On Thursday, 31 October 2013 at 23:48:19 UTC, Jonathan M Davis wrote:
> On Thursday, October 31, 2013 23:06:22 Namespace wrote:
>> On Thursday, 31 October 2013 at 09:53:39 UTC, Jonathan M Davis
>> 
>> wrote:
>> > On Thursday, October 31, 2013 10:15:51 Namespace wrote:
>> >> I'm sure we had already this conversation but I don't find the
>> >> thread.
>> >> 
>> >> T[] buffer = new T[N]; assumes more space than stated (in
>> >> average
>> >> 2010 elements more. See: http://dpaste.dzfl.pl/af92ad22c). It
>> >> behaves exactly like reserve and that is IMO wrong. If I
>> >> reserve
>> >> memory with buffer.reserve(N), I want to have at least N
>> >> elements. That behaviour is correct. But if I use new T[N] I
>> >> mostly want exactly N elements and no extra space.
>> >> 
>> >> Thoughts?
>> > 
>> > You're making the assumption that it would be normal to not
>> > want to then
>> > append to something you allocated with new T[N], and I don't
>> > think that that's
>> > a valid assumption.
>> 
>> I disagree. If I want to append I use reserve and I think that is
>> the most common approach.
>
> I would fully expect that most people don't bother with reserve or capacity
> and that they simply create the array at whatever size they create it at and
> then append to it without worrying about reserve. But we'd have to get real
> data on that to know for sure one way or the other.
>
> Certainly, most folks who are focusing on append performance seem to use
> Appender, and for the most part, I would suggest that anyone using reserve
> should be using Appender instead.
>
> - Jonathan M Davis

Currently Appender isn't more performant than built-in arrays. ;)
November 01, 2013
On Friday, November 01, 2013 01:16:53 Namespace wrote:
> Currently Appender isn't more performant than built-in arrays. ;)

If Appender is not more performant for appending than just appending to a naked array, then something is very wrong with Appender, because it's whole job is to make sure that it calls all of the appropriate functions on its internal array which it needs to in order to make appending efficient (e.g. assumeSafeAppend).

- Jonathan M Davis
November 01, 2013
On Friday, 1 November 2013 at 00:16:55 UTC, Namespace wrote:
> On Thursday, 31 October 2013 at 23:48:19 UTC, Jonathan M Davis wrote:
>> On Thursday, October 31, 2013 23:06:22 Namespace wrote:
>>> On Thursday, 31 October 2013 at 09:53:39 UTC, Jonathan M Davis
>>> 
>>> wrote:
>>> > On Thursday, October 31, 2013 10:15:51 Namespace wrote:
>>> >> I'm sure we had already this conversation but I don't find the
>>> >> thread.
>>> >> 
>>> >> T[] buffer = new T[N]; assumes more space than stated (in
>>> >> average
>>> >> 2010 elements more. See: http://dpaste.dzfl.pl/af92ad22c). It
>>> >> behaves exactly like reserve and that is IMO wrong. If I
>>> >> reserve
>>> >> memory with buffer.reserve(N), I want to have at least N
>>> >> elements. That behaviour is correct. But if I use new T[N] I
>>> >> mostly want exactly N elements and no extra space.
>>> >> 
>>> >> Thoughts?
>>> > 
>>> > You're making the assumption that it would be normal to not
>>> > want to then
>>> > append to something you allocated with new T[N], and I don't
>>> > think that that's
>>> > a valid assumption.
>>> 
>>> I disagree. If I want to append I use reserve and I think that is
>>> the most common approach.
>>
>> I would fully expect that most people don't bother with reserve or capacity
>> and that they simply create the array at whatever size they create it at and
>> then append to it without worrying about reserve. But we'd have to get real
>> data on that to know for sure one way or the other.
>>
>> Certainly, most folks who are focusing on append performance seem to use
>> Appender, and for the most part, I would suggest that anyone using reserve
>> should be using Appender instead.
>>
>> - Jonathan M Davis
>
> Currently Appender isn't more performant than built-in arrays. ;)

I have found it more performant. A sensible test case where it is slower should be filed as a bug.
November 01, 2013
It is. I don't know if it is fixed already, and I don't have the time to search for the thread. But afaik monarch filled the bug.
1 2
Next ›   Last »