reserving cuts down on the reallocations, but that only takes
some of the time. Appending a 1000-element int array is going
to go from a 16-byte block, to a 32-byte block, etc. up to a
4096 byte block. This involves roughly 8 reallocations per test.
But every append requires an opaque function
Hi fellow Dlangers,
I am working on an old codebase, and found a re-implementation of
standard dynamic arrays as a struct called [ArrayBuilder, visible
on my github](https://tinyurl.com/2nr25ytt)
The comment says:
```d
/**
* Behaves the same as built-in arrays, except about 6x faster
with c
Thank Steve,
I open a new thread with some corrections, better title, etc.
On Wednesday, 31 March 2021 at 22:05:12 UTC, Steven Schveighoffer
wrote:
On 3/31/21 5:32 PM, ludo wrote:
[...]
ArrayBuilder should be similar in performance to Appender. I
think part of the issue with appender could
Hi guys,
I am working on an old software in D1, which defines at some
point an array.d module. See my github file:
https://tinyurl.com/5ffbmfvz
If you go line 347, you see an ArrayBuilder struct, which is
supposed to behave exactly like an array but with faster
concatenation. The class comm
However, I think this is all moot, druntime is the same as
Tango.
Moot you mean debatable? Or irrelevant :) Thanks to your
explanations, I understand now that the dev tried to imitate a
Tango feature with very old D1 code. This is 2005/2009 code
And as pointed out by IGotD-, better not to me
Hi guys,
still working on old D1 code, to be updated to D2. At some point
the previous dev wrote a FastLock class. The top comment is from
the dev himself, not me. My question is after the code.
---
class FastLock
{
protected Mutex mutex;
protected int lockCount;
prot
The mutex isn't more "global", it's more "local" (although,
this will make it shared).
Yes shared, this is what I meant by global :) Thanks, it's
clearer now.
Thanks, as explained I am indeed porting old code.
No on the AA (as noted above). The mutex *is* created on
demand. Every Object can have a mutex, and it's only created
when you synchronize it for the first time.
Yes alright. I think the dev made a design mistake because he
called synchroniz
I believe so. I've never used OpenAL so it may have additional
restrictions with multithreading, but from a simple "This
function is only ever executed on one thread at a time", your
above suggestions should work.
Apologies for the late reply.
No worry and thank you. I found the low-lock pat
NOTE : the entire code we are talking about is in the tiny url in
my previous post.
On Thursday, 7 January 2021 at 01:55:07 UTC, SealabJaster wrote:
On Wednesday, 6 January 2021 at 17:05:02 UTC, ludo wrote:
...
Using a static class like this seems to mostly be a design
decision.
So in ot
I read in the documentation
"Static constructors are used to initialize static class members
with values that cannot be computed at compile time"
I try to understand the design of the following code:
---
class OpenAL
{
static string[int] ALErrorLookup;
static Object mutex;
11 matches
Mail list logo