On Monday, 22 July 2013 at 09:26:33 UTC, David wrote:
Am 22.07.2013 10:41, schrieb Namespace:
It's part of Dgame and it's the shape draw method. The method
collects
the vertices and give them to the vertex buffer.
I will try it with my current way: static stack buffer with a
size of
1024 and o
On 2013-07-21 12:18, Namespace wrote:
But then I have mostly far too much and maybe a few times a bit too less
store. It's not flexible. But maybe with a smaller granule.
What's about this:
You said you needed between 100 and 4000 floats. My suggestion will
allocate 4000 floats once per threa
Am 22.07.2013 10:41, schrieb Namespace:
> It's part of Dgame and it's the shape draw method. The method collects
> the vertices and give them to the vertex buffer.
> I will try it with my current way: static stack buffer with a size of
> 1024 and otherwise I will temporary allocate memory. But how
It's part of Dgame and it's the shape draw method. The method
collects the vertices and give them to the vertex buffer.
I will try it with my current way: static stack buffer with a
size of 1024 and otherwise I will temporary allocate memory. But
how much shapes grow larger than 1024 vertices ;)
On Sunday, 21 July 2013 at 21:35:15 UTC, Namespace wrote:
On Sunday, 21 July 2013 at 21:31:08 UTC, bearophile wrote:
Namespace:
I have a float[1024] buffer which is used, as long as the
requested size is less than 1024. If it's greater, I will
temporary allocate the whole array with new float
On Sunday, 21 July 2013 at 21:31:08 UTC, bearophile wrote:
Namespace:
I have a float[1024] buffer which is used, as long as the
requested size is less than 1024. If it's greater, I will
temporary allocate the whole array with new float[Size];
That's one of the ways I solve similar problems.
22-Jul-2013 01:19, Namespace пишет:
I really like the idea.
I've changed it a bit:
I have a float[1024] buffer which is used, as long as the requested size
is less than 1024. If it's greater, I will temporary allocate the whole
array with new float[Size];
Any improvements? Or is 1024 to small /
Namespace:
I have a float[1024] buffer which is used, as long as the
requested size is less than 1024. If it's greater, I will
temporary allocate the whole array with new float[Size];
That's one of the ways I solve similar problems.
Any improvements? Or is 1024 to small / big?
An idea is
My analogy goes as follows: a chunk of memory for temporary
needs => scratch pad (as in sheet of paper for quick
notes/sketches).
Something along the lines of:
class A{
static float[] buffer;
static this(){
buffer = new float[as_big_as_it_gets];
}
21-Jul-2013 00:42, Ali Çehreli пишет:
On 07/20/2013 01:22 PM, Dmitry Olshansky wrote:
> 21-Jul-2013 00:19, Namespace пишет:
>> Let us assume we have a method of a class which is used often and the
>> method is called periodically and must allocate every time a array
>> between 100 and 4000 e
21-Jul-2013 00:46, Namespace пишет:
On Saturday, 20 July 2013 at 20:22:56 UTC, Dmitry Olshansky wrote:
21-Jul-2013 00:19, Namespace пишет:
Let us assume we have a method of a class which is used often and the
method is called periodically and must allocate every time a array
between 100 and 400
Namespace:
I agree, but how? ;)
You know by yourself that Walter & Andrei are very hard to
convince by such things.
I think there is only a small number of Ada ideas worth copying,
like:
- Integral overflows;
- Ranged integers;
- A library of collections allocated in-place in the standard
On Sunday, 21 July 2013 at 10:30:16 UTC, bearophile wrote:
Namespace:
But D isn't like Ada.
But D should be a bit more like Ada, for such things :-)
Bye,
bearophile
I agree, but how? ;)
You know by yourself that Walter & Andrei are very hard to
convince by such things.
Namespace:
But D isn't like Ada.
But D should be a bit more like Ada, for such things :-)
Bye,
bearophile
On Sunday, 21 July 2013 at 09:16:47 UTC, Jacob Carlborg wrote:
On 2013-07-21 08:45, Namespace wrote:
But D isn't like Ada. It's more like C++ and there Heap
allocations is
often used too.
It would be really cool if we had allocators already.
Something like:
with (AllocatorX) { /// will use
On 2013-07-21 08:45, Namespace wrote:
But D isn't like Ada. It's more like C++ and there Heap allocations is
often used too.
It would be really cool if we had allocators already.
Something like:
with (AllocatorX) { /// will use malloc and free instead of calling the GC
float[] arr;
But D isn't like Ada. It's more like C++ and there Heap
allocations is often used too.
It would be really cool if we had allocators already.
Something like:
with (AllocatorX) { /// will use malloc and free instead of
calling the GC
float[] arr;
arr ~= 42;
}
And I still don't
Namespace:
So, you would never allocate with float[]?
Generally in D I allocate on the heap with new, and once in a
while with minimallyInitializedArray. Stack-allocation is left
for situations where max performance is needed. Like you have to
build a tree of string distances, and you use a
On Saturday, 20 July 2013 at 21:39:31 UTC, bearophile wrote:
Namespace:
Yeah, but aren't 4000 elements a bit much for a stack
allocated array?
4000 floats take about 16 KB. If your function is not recursive
and it's not much transitively recursive, then I think it's
acceptable. But how much
Namespace:
Yeah, but aren't 4000 elements a bit much for a stack allocated
array?
4000 floats take about 16 KB. If your function is not recursive
and it's not much transitively recursive, then I think it's
acceptable. But how much stack are your other functions using?
You have to estimate i
On Saturday, 20 July 2013 at 20:34:50 UTC, bearophile wrote:
Namespace:
But I want to hear other opinions. :)
D also supports alloca(), that for 1D arrays is almost bearable.
See also:
http://d.puremagic.com/issues/show_bug.cgi?id=9832
Bye,
bearophile
Yeah, but aren't 4000 elements a bit
On Saturday, 20 July 2013 at 20:22:56 UTC, Dmitry Olshansky wrote:
21-Jul-2013 00:19, Namespace пишет:
Let us assume we have a method of a class which is used often
and the
method is called periodically and must allocate every time a
array
between 100 and 4000 elements. What would you do?
1.
On 07/20/2013 01:22 PM, Dmitry Olshansky wrote:
> 21-Jul-2013 00:19, Namespace пишет:
>> Let us assume we have a method of a class which is used often and the
>> method is called periodically and must allocate every time a array
>> between 100 and 4000 elements. What would you do?
> 5. Keep a TL
Namespace:
But I want to hear other opinions. :)
D also supports alloca(), that for 1D arrays is almost bearable.
See also:
http://d.puremagic.com/issues/show_bug.cgi?id=9832
Bye,
bearophile
21-Jul-2013 00:19, Namespace пишет:
Let us assume we have a method of a class which is used often and the
method is called periodically and must allocate every time a array
between 100 and 4000 elements. What would you do?
1. Simple: float[] array;
2. Reserve: float[] array; array.reserve(N); //
25 matches
Mail list logo