On Wednesday, 28 December 2016 at 12:30:33 UTC, Michael Rynn
wrote:
It takes a bit of work to get around the mutable buffers
problem in D language arrays. I found it made a performance
difference in xml parsing.
https://github.com/betrixed/dlang-xml/blob/master/xml/util/buffer.d
/**
It takes a bit of work to get around the mutable buffers problem in D
language arrays. I found it made a performance difference in xml parsing.
https://github.com/betrixed/dlang-xml/blob/master/xml/util/buffer.d
/**
Buffer(T) - Versatile appendable D array for buffer reuse,
append, re
On 7/14/16 5:56 AM, Miguel L wrote:
On Thursday, 14 July 2016 at 09:12:50 UTC, Jonathan M Davis wrote:
So, whether you should be using Appender or assumeSafeAppend or
neither depends entirely on what you're doing. However, in general,
simply appending to dynamic arrays does not result in many
re
On Thursday, July 14, 2016 09:56:02 Miguel L via Digitalmars-d-learn wrote:
> Thank you Jonathan, that really cleared up a lot of things, I
> read the article. But I still have this doubt: is
> assumeSafeAppend() changing a property of the array as "this
> array is never going to be referenced by a
On Thursday, 14 July 2016 at 09:12:50 UTC, Jonathan M Davis wrote:
So, whether you should be using Appender or assumeSafeAppend or
neither depends entirely on what you're doing. However, in
general, simply appending to dynamic arrays does not result in
many reallocations (just like it doesn't r
On Thursday, July 14, 2016 07:07:52 Miguel L via Digitalmars-d-learn wrote:
> Ok, i have read about Appender and assumeSafeAppend(), but i am
> still a bit confused.
> What i have understood is: dynamic arrays are (almost) always
> reallocating when appending to them except assumeSafeAppend() is
>
On Wednesday, 13 July 2016 at 17:19:09 UTC, Steven Schveighoffer
wrote:
On 7/13/16 8:41 AM, Lodovico Giaretta wrote:
On Wednesday, 13 July 2016 at 12:37:26 UTC, Miguel L wrote:
I tried Appender, but for some reason garbage collector still
seems to
be running every few iterations.
I will try to
On 7/13/16 8:41 AM, Lodovico Giaretta wrote:
On Wednesday, 13 July 2016 at 12:37:26 UTC, Miguel L wrote:
I tried Appender, but for some reason garbage collector still seems to
be running every few iterations.
I will try to expand a little on my code because maybe there is
something i am missing:
On Wednesday, July 13, 2016 11:59:18 Miguel L via Digitalmars-d-learn wrote:
> I am using a temporary dynamic array inside a loop this way:
> A[] a;
> for()
> {
> a=[]; //discard array contents
> ... appends thousand of elements to a
> ... use a for some calculations
> }
>
> I would like to kno
On Wednesday, 13 July 2016 at 12:37:26 UTC, Miguel L wrote:
I tried Appender, but for some reason garbage collector still
seems to be running every few iterations.
I will try to expand a little on my code because maybe there is
something i am missing:
Appender!(A[]) a;
void foo( out Appende
On Wednesday, 13 July 2016 at 12:05:18 UTC, Lodovico Giaretta
wrote:
On Wednesday, 13 July 2016 at 11:59:18 UTC, Miguel L wrote:
I am using a temporary dynamic array inside a loop this way:
A[] a;
for()
{
a=[]; //discard array contents
... appends thousand of elements to a
... use a for some
On Wednesday, 13 July 2016 at 12:05:12 UTC, rikki cattermole
wrote:
On 13/07/2016 11:59 PM, Miguel L wrote:
The options would be:
a=[];
a.length=0;
a=null;
...
any other?
Can you help me please?
All of those "options" do the same thing, remove all references
to that data.
No they don't. T
On Wednesday, 13 July 2016 at 12:22:55 UTC, Lodovico Giaretta
wrote:
On Wednesday, 13 July 2016 at 12:20:07 UTC, cym13 wrote:
The best option would be a.clear(). From the language specs:
“Removes all remaining keys and values from an associative
array. The array is not rehashed after removal,
On Wednesday, 13 July 2016 at 12:20:07 UTC, cym13 wrote:
The best option would be a.clear(). From the language specs:
“Removes all remaining keys and values from an associative
array. The array is not rehashed after removal, to allow for
the existing storage to be reused. This will affect all
On Wednesday, 13 July 2016 at 11:59:18 UTC, Miguel L wrote:
I am using a temporary dynamic array inside a loop this way:
A[] a;
for()
{
a=[]; //discard array contents
... appends thousand of elements to a
... use a for some calculations
}
I would like to know which would be the best way to c
On Wednesday, 13 July 2016 at 11:59:18 UTC, Miguel L wrote:
The options would be:
a=[];
a.length=0;
a=null;
...
any other?
it really depends of your other code. if you don't have any
slices of the array, for example, you can use `a.length = 0;
a.assumeSafeAppend;` -- this will reuse the allo
On Wednesday, 13 July 2016 at 11:59:18 UTC, Miguel L wrote:
I am using a temporary dynamic array inside a loop this way:
A[] a;
for()
{
a=[]; //discard array contents
... appends thousand of elements to a
... use a for some calculations
}
I would like to know which would be the best way to c
On 13/07/2016 11:59 PM, Miguel L wrote:
I am using a temporary dynamic array inside a loop this way:
A[] a;
for()
{
a=[]; //discard array contents
... appends thousand of elements to a
... use a for some calculations
}
I would like to know which would be the best way to clear a contents
avoi
I am using a temporary dynamic array inside a loop this way:
A[] a;
for()
{
a=[]; //discard array contents
... appends thousand of elements to a
... use a for some calculations
}
I would like to know which would be the best way to clear a
contents avoiding reallocations, as there seems to be
19 matches
Mail list logo