Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread ketmar via Digitalmars-d-learn

On Wednesday, 7 December 2016 at 02:38:50 UTC, bpr wrote:
It's a counterfactual at this point, but I would guess that if 
D had left out the GC in 2010 when D2 came out it would have 
been ahead of C++ in many ways and perhaps would have been able 
to peel off more C++ programmers


c++ programmers want c++. anything that is not c++ will be bashed 
to death. there is absolutely no reason to kill one of the key D 
features only to attract 2.5 c++ coders. actually, we already 
have That One C++ Programmer We Need onboard -- Andrei. ;-)


Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread Picaud Vincent via Digitalmars-d-learn
On Tuesday, 6 December 2016 at 17:00:35 UTC, Jonathan M Davis 
wrote:
So, while there are certainly folks who would prefer using D as 
a better C without druntime or Phobos, I think that you're 
seriously overestimating how many folks would be interested in 
that. Certainly, all of the C++ programmers that I've worked 
with professionally would have _zero_ interest in D as a better 
C.


- Jonathan M Davis


Considering scientific/numerical applications, I do agree with 
Ilya: it is mandatory to have zero overhead and a 
straightforward/direct interoperability with C. I am impressed by 
the Mir lib results and I think "BetterC" is very 
attractive/important.


-- Vincent


Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, December 07, 2016 02:38:50 bpr via Digitalmars-d-learn wrote:
> On Tuesday, 6 December 2016 at 22:47:34 UTC, Jonathan M Davis
> > We get plenty of folks who aren't big C/C++ programmers who are
> > interested in D. Yes, the majority seem to have a C++
> > background, but we also get folks from C#, python, ruby, etc.
>
> It would be nice to see a breakdown. From where I sit, it appears
> that most of the interest in D is from C++ users, and it doesn't
> appear that D popularity is rising so much. Any data that belies
> that sad assessment?

As I understand it, the downloads have been increasing year over year. At
least some years, Andrei has given some statistics on the state of D in his
dconf talk. And per his stats, forum/newsgroup activity was going up too,
though I get the impression that at least in the main newsgroup, it may have
actually dropped off (whereas Learn seems like it's been growing). That's
just my impression though. I'm sure github activity has gone up over time
though.

It's my understanding that D's usage has continued to grow but that it isn't
growing super fast, whereas languages such as Go and Rust do seem to have
grown very quickly (probably at least in part due to the companies behind
them). But other languages have taken a long time to catch on and still
ended up being very successful with large user bases (e.g. that's what
happened with python).

It's also hard to gauge how much D is really being used. The number of
companies saying that they're using D seems to have increased, but there are
who-knows how many folks using D who haven't said anything, and we really
don't have much to go on besides the downloads, which only capture a portion
of the D's users and even then only tells you how often dmd was downloaded,
not how many people it was or if they're new users or whatnot. And
downloading dmd from dlang.org is not the only way to get it.

There are definitely things that we can be and should be doing to improve
D's traction (like better supporting @nogc in Phobos), but I don't think
that we're doing badly. And often, the problem seems to be more of a PR one
than anything technical (e.g. I think that we're finally pretty much beyond
the issues caused by the confusion over Tango vs Phobos in D1, but it took a
long time). And honestly, much as there are technical problems related to
the GC, the far bigger problem seems to be the PR issues related to it.
Sadly, the simple fact that we _have_ a GC has been a PR problem, regardless
of the actual state of things. But regardless, we do seem to be gaining
traction, even if it's not as quickly as we might like.

- Jonathan M Davis



Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread bachmeier via Digitalmars-d-learn

On Wednesday, 7 December 2016 at 02:24:56 UTC, bpr wrote:
If I really *want* to use a GC, say I'm writing a server and I 
believe that a well tuned GC will allow my server to stay alive 
much longer with less fragmentation, I'll probably skip D and 
pick Go or maybe (hmmm...) even Java because their GCs have had 
a lot of engineering effort.




Writing a server is quite narrow compared to the "programmers who 
are comfortable working in a GC-ed language" that I was 
responding to.


I wonder what percentage of Ruby programmers have thought 
about garbage collection ever.


Why would a Ruby or Python programmer unconcerned with 
performance want to switch to D? I'm sure there are some who 
would, but I'd imagine they're rare.


Maybe some prefer D as a language? The same argument could be 
used against any language. Performance is far from the only 
reason to use D.


Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread bpr via Digitalmars-d-learn
On Tuesday, 6 December 2016 at 22:47:34 UTC, Jonathan M Davis 
wrote:
On Tuesday, December 06, 2016 22:13:54 bpr via 
Digitalmars-d-learn wrote:

On Tuesday, 6 December 2016 at 17:00:35 UTC, Jonathan M Davis

wrote:
Sure, there are folks who would prefer not to have to deal with 
the GC but throw out the runtime and std lib? You lose out on 
too much for it to be at all worth it for many folks. At that 
point, C++11/14/17 looks far more appealing, especially as it 
continues to improve.


It's a counterfactual at this point, but I would guess that if D 
had left out the GC in 2010 when D2 came out it would have been 
ahead of C++ in many ways and perhaps would have been able to 
peel off more C++ programmers and achieve the momentum that Rust 
appears to have now. Yes, it would be missing some features on 
account of omitting GC, but D2 -GC in 2010 is still much better 
than C++ 2011. As C++ absorbs D features, the case for D seems 
weaker.


We get plenty of folks who aren't big C/C++ programmers who are 
interested in D. Yes, the majority seem to have a C++ 
background, but we also get folks from C#, python, ruby, etc.


It would be nice to see a breakdown. From where I sit, it appears 
that most of the interest in D is from C++ users, and it doesn't 
appear that D popularity is rising so much. Any data that belies 
that sad assessment?





Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread bpr via Digitalmars-d-learn

On Tuesday, 6 December 2016 at 22:23:25 UTC, bachmeier wrote:

On Tuesday, 6 December 2016 at 22:13:54 UTC, bpr wrote:
Those programmers who are comfortable working in a GC-ed 
language will likely eschew D because D's GC is really not 
that great.


So someone working with Ruby is not going to want to work with 
D because of GC performance?


Ruby programmers are probably not concerned with performance at 
all ever. It's a slow interpreted language with a GIL. But if 
you're on a Rails project, that's what you'll use.


If I really *want* to use a GC, say I'm writing a server and I 
believe that a well tuned GC will allow my server to stay alive 
much longer with less fragmentation, I'll probably skip D and 
pick Go or maybe (hmmm...) even Java because their GCs have had a 
lot of engineering effort.


I wonder what percentage of Ruby programmers have thought about 
garbage collection ever.


Why would a Ruby or Python programmer unconcerned with 
performance want to switch to D? I'm sure there are some who 
would, but I'd imagine they're rare.





Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread Timothee Cour via Digitalmars-d-learn
My 2 cents: for most applications, hotspots tend to be in a tiny percentage
of the code (ie 90/10 rule where 10% of code accounts for 90% execution
time, although my experience in large projects is even more unbalanced) ;
throwing away druntime or GC for the whole codebase based on performance
concerns amounts to (evil) early optimization.

It's far more productive to use a profiler and carefully optimize only the
parts that need to be (possibly using betterc, @nogc, ldc and optimized
compiler flags for those hotspots only).

What could be done better would be to remove friction when linking in
shared objects produced by dmd and ldc (eg, extern(D) functions have
different number of underscores in dmd vs ldc).

On that note, even if dmd is 50x slower than ldc for certain blas mir
routines, it's still valuable to have mir supported by dmd as we can always
swap in the slow parts during production runs, but we'd benefit with fast
compile time during development time,



On Tue, Dec 6, 2016 at 3:08 PM, aberba via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:

> On Tuesday, 6 December 2016 at 22:13:54 UTC, bpr wrote:
>
>> On Tuesday, 6 December 2016 at 17:00:35 UTC, Jonathan M Davis
>>
>
> I would guess that the vast majority of interest shown in Rust is from
>> people who essentially want a better C or C++, with no runtime/GC. So, I
>> think Ilya's point is very plausible. D with no GC, but with modules,
>> templates, overloading, CTFE, and some other features might have been more
>> tempting to the no-GC crowd, which includes many hardcore C++ programmers.
>>
>> Those programmers who are comfortable working in a GC-ed language will
>> likely eschew D because D's GC is really not that great.
>>
>
>
> I don't really get the issue with D's GC, Phobos and DRuntime. JavaScript
> is really popular and getting really popular everyday (I mean Nodejs). Same
> as Python, PHP, Ruby (startups), etc. But they are not exactly betterC.
> Most of them don't even give native code speed.
>
> When using D, I just want to get my app working and running. That is why
> more packages (vibe.d, mail, request, mysql-lited, etc) matter to me. The
> level you are trying to raise D is way over-kill IMO :). It's good though
> for those who need it. But most of us don't judge languages that way.
>


Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread aberba via Digitalmars-d-learn

On Tuesday, 6 December 2016 at 22:13:54 UTC, bpr wrote:

On Tuesday, 6 December 2016 at 17:00:35 UTC, Jonathan M Davis


I would guess that the vast majority of interest shown in Rust 
is from people who essentially want a better C or C++, with no 
runtime/GC. So, I think Ilya's point is very plausible. D with 
no GC, but with modules, templates, overloading, CTFE, and some 
other features might have been more tempting to the no-GC 
crowd, which includes many hardcore C++ programmers.


Those programmers who are comfortable working in a GC-ed 
language will likely eschew D because D's GC is really not that 
great.



I don't really get the issue with D's GC, Phobos and DRuntime. 
JavaScript is really popular and getting really popular everyday 
(I mean Nodejs). Same as Python, PHP, Ruby (startups), etc. But 
they are not exactly betterC. Most of them don't even give native 
code speed.


When using D, I just want to get my app working and running. That 
is why more packages (vibe.d, mail, request, mysql-lited, etc) 
matter to me. The level you are trying to raise D is way 
over-kill IMO :). It's good though for those who need it. But 
most of us don't judge languages that way.


Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, December 06, 2016 22:13:54 bpr via Digitalmars-d-learn wrote:
> On Tuesday, 6 December 2016 at 17:00:35 UTC, Jonathan M Davis
>
> wrote:
> > So, while there are certainly folks who would prefer using D as
> > a better C without druntime or Phobos, I think that you're
> > seriously overestimating how many folks would be interested in
> > that. Certainly, all of the C++ programmers that I've worked
> > with professionally would have _zero_ interest in D as a better
> > C.
>
> I would guess that the vast majority of interest shown in Rust is
> from people who essentially want a better C or C++, with no
> runtime/GC. So, I think Ilya's point is very plausible. D with no
> GC, but with modules, templates, overloading, CTFE, and some
> other features might have been more tempting to the no-GC crowd,
> which includes many hardcore C++ programmers.

Sure, there are folks who would prefer not to have to deal with the GC but
throw out the runtime and std lib? You lose out on too much for it to be at
all worth it for many folks. At that point, C++11/14/17 looks far more
appealing, especially as it continues to improve. And @nogc and sane memory
use largely solves the GC problem for many programs. There are some places
where we need to improve the situation (like with lambdas and the GC), but
for most programs, it's totally workable as-is without giving up on all of
the features provided by the runtime and Phobos.

If you really need absolute pedal-to-the-metal performance and can't afford
to ever have the GC stop the world, you still don't need to actually throw
away the runtime and std lib. You're just a lot more restricted in what you
can do with them. So, tossing out druntime and Phobos entirely seems rather
extreme. It may very well make really good sense for a subset of D programs,
but I have a hard time believing that it's anything more than a small
subset.

> Those programmers who are comfortable working in a GC-ed language
> will likely eschew D because D's GC is really not that great.

We get plenty of folks who aren't big C/C++ programmers who are interested
in D. Yes, the majority seem to have a C++ background, but we also get folks
from C#, python, ruby, etc.

- Jonathan M Davis



Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread bachmeier via Digitalmars-d-learn

On Tuesday, 6 December 2016 at 22:13:54 UTC, bpr wrote:
Those programmers who are comfortable working in a GC-ed 
language will likely eschew D because D's GC is really not that 
great.


So someone working with Ruby is not going to want to work with D 
because of GC performance? I wonder what percentage of Ruby 
programmers have thought about garbage collection ever. I could 
see an argument that there are existing frameworks or some other 
reason to prefer another language, but it is highly unlikely that 
GC would be the reason that both C++ and Ruby programmers would 
not want to use D.


Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread bpr via Digitalmars-d-learn
On Tuesday, 6 December 2016 at 17:00:35 UTC, Jonathan M Davis 
wrote:
So, while there are certainly folks who would prefer using D as 
a better C without druntime or Phobos, I think that you're 
seriously overestimating how many folks would be interested in 
that. Certainly, all of the C++ programmers that I've worked 
with professionally would have _zero_ interest in D as a better 
C.


I would guess that the vast majority of interest shown in Rust is 
from people who essentially want a better C or C++, with no 
runtime/GC. So, I think Ilya's point is very plausible. D with no 
GC, but with modules, templates, overloading, CTFE, and some 
other features might have been more tempting to the no-GC crowd, 
which includes many hardcore C++ programmers.


Those programmers who are comfortable working in a GC-ed language 
will likely eschew D because D's GC is really not that great.





Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 6 December 2016 at 20:01:38 UTC, Ilya Yaroshenko 
wrote:
On Tuesday, 6 December 2016 at 17:00:35 UTC, Jonathan M Davis 
wrote:
So, while there are certainly folks who would prefer using D 
as a better C without druntime or Phobos, I think that you're 
seriously overestimating how many folks would be interested in 
that. Certainly, all of the C++ programmers that I've worked 
with professionally would have _zero_ interest in D as a 
better C.


- Jonathan M Davis


My experience is completely orthogonal. --Ilya


There is a theorem that all programming language discussions on 
the internet start with the assumption that real programming is 
exactly the same as the programming done by the author.


Re: Impressed with Appender - Is there design/implementation description?

2016-12-06 Thread Jon Degenhardt via Digitalmars-d-learn
On Tuesday, 6 December 2016 at 15:29:59 UTC, Jonathan M Davis 
wrote:
On Tuesday, December 06, 2016 13:19:22 Anonymouse via 
Digitalmars-d-learn wrote:

On Tuesday, 6 December 2016 at 10:52:44 UTC, thedeemon wrote:

[...]

> 2. Up until 4 KB it reallocates when growing, but after 4 KB 
> the array lives in a larger pool of memory where it can 
> often grow a lot without reallocating, so in many scenarios 
> where other allocations do not interfere, the data array of 
> appender grows in place without copying any data, thanks to 
> GC.extend() method.


I always assumed it kept its own manually allocated array on a 
malloc heap :O


No. The main thing that Appender does is reduce the number of 
checks required for whether there's room for the array to 
append in place, because that check is a good chunk of why ~= 
is expensive for arrays.

[...]


Thanks everyone for the explanations. I should probably look into 
my data and see how often I'm reaching the 4kb size triggering 
GC.extend() use.


--Jon



Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Tuesday, 6 December 2016 at 17:00:35 UTC, Jonathan M Davis 
wrote:
So, while there are certainly folks who would prefer using D as 
a better C without druntime or Phobos, I think that you're 
seriously overestimating how many folks would be interested in 
that. Certainly, all of the C++ programmers that I've worked 
with professionally would have _zero_ interest in D as a better 
C.


- Jonathan M Davis


My experience is completely orthogonal. --Ilya


Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, December 06, 2016 13:36:20 Ilya Yaroshenko via Digitalmars-d-
learn wrote:
> On Tuesday, 6 December 2016 at 13:02:16 UTC, Andrei Alexandrescu
>
> wrote:
> > On 12/6/16 3:28 AM, Ilya Yaroshenko wrote:
> >> On Tuesday, 6 December 2016 at 08:14:17 UTC, Andrea Fontana
> >>
> >> wrote:
> >>> On Monday, 5 December 2016 at 20:25:00 UTC, Ilya Yaroshenko
> >>> Phobos/Druntime are pretty good for a lot of projects.
> >>
> >> In theory
> >
> > And what seem to be the issues in practice with code that is
> > not highly specialized? -- Andrei
>
> If code is not highly specialized there is no reason to spent
> resources to use C/C++/D. A company will be happy with Python,
> Java, C#, Go and Swift. If one need to have C/C++ programming
> level he can not use D because DRuntime. Only a subset of D can
> be used. And current problem that we have not BetterC paradigm in
> D specification. So, only crazy companies will consider D for
> large projects. Current D is successful in small console text
> routines.
>
> If a system PL can not be used as C for highly specialized code,
> it is not a real system PL.
>
> DRuntime and Phobos is going to compete with Java and Go. It is
> suicide for D, IMHO. In other hand, BetterC is a direction where
> D can be populated among professionals and replace C/C++.

While I am quite sure that there are use cases where folks would be unhappy
with druntime and Phobos and want to avoid them, there are definitely
companies using D with druntime and Phobos right now, and personally, I've
never worked at a company where anything about druntime or Phobos would have
been a showstopper in switching to D. The showstopper would be in convincing
them to use a new language rather than one that they were already familiar
with. C++ works for them, and they're not interested in switching. And
honestly, pushing for a subset of D that didn't have the functionality in
druntime and Phobos would just make it an even harder sell. At that point,
they're _really_ not interested in using D. C++11/14/17 quickly and easily
wins out in that fight.

So, while there are certainly folks who would prefer using D as a better C
without druntime or Phobos, I think that you're seriously overestimating how
many folks would be interested in that. Certainly, all of the C++
programmers that I've worked with professionally would have _zero_ interest
in D as a better C.

- Jonathan M Davis



Re: Impressed with Appender - Is there design/implementation description?

2016-12-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, December 06, 2016 13:19:22 Anonymouse via Digitalmars-d-learn 
wrote:
> On Tuesday, 6 December 2016 at 10:52:44 UTC, thedeemon wrote:
> > It's rather simple, just take a look at its source code in
> > std.array.
> > It's an ordinary linear array partially filled with your data.
>
> [...]
>
> > 2. Up until 4 KB it reallocates when growing, but after 4 KB
> > the array lives in a larger pool of memory where it can often
> > grow a lot without reallocating, so in many scenarios where
> > other allocations do not interfere, the data array of appender
> > grows in place without copying any data, thanks to GC.extend()
> > method.
>
> I always assumed it kept its own manually allocated array on a
> malloc heap :O

No. The main thing that Appender does is reduce the number of checks
required for whether there's room for the array to append in place, because
that check is a good chunk of why ~= is expensive for arrays. And using ~=
isn't all that bad. It's just that it adds up, and when you're clearly going
to be doing a lot of appending when you first create a dynamic array, it's
just more efficient to use Appender and avoid the extra overhead that ~=
has. What Appender does with put is actually pretty close to what druntime
does with ~=. It's just that Appender can just look at the member variable
to know the capacity of the dynamic array, whereas ~= has to look it up by
looking at the data for the memory block that the dynamic array currently
points to.

All Appender really is is a way to make appending to dynamic arrays more
efficient. It doesn't do anything magical with data structures. At present,
this is what it's member variables look like

private alias T = ElementEncodingType!A;
private struct Data
{
size_t capacity;
Unqual!T[] arr;
bool canExtend = false;
}

private Data* _data;

The magic is in that extra capacity variable, but otherwise, you're
basically dealing with the same array appending you get out of ~=.

> Hence a practice of using .dup and .idup on the .data member when
> you're happy with the result?

That isn't necessary. I don't think that I ever do it. If you want to keep
appending with Appender, and you want a dynamic array that has its own
memory to grow into without being affected by Appender, then it would make
sense to use dup/idup, but that's true any time that you append to a dynamic
array. And you might want dup/idup to get a dynamic array with a different
type of mutability than the dynamic array in the Appender just like you
might want with a naked dynamic array, but since you define the mutability
with Appender, you'd usually just change the array type that you
instantiated Appender with.

- Jonathan M Davis



Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Tuesday, 6 December 2016 at 13:02:16 UTC, Andrei Alexandrescu 
wrote:

On 12/6/16 3:28 AM, Ilya Yaroshenko wrote:
On Tuesday, 6 December 2016 at 08:14:17 UTC, Andrea Fontana 
wrote:

On Monday, 5 December 2016 at 20:25:00 UTC, Ilya Yaroshenko
Phobos/Druntime are pretty good for a lot of projects.


In theory


And what seem to be the issues in practice with code that is 
not highly specialized? -- Andrei


If code is not highly specialized there is no reason to spent 
resources to use C/C++/D. A company will be happy with Python, 
Java, C#, Go and Swift. If one need to have C/C++ programming 
level he can not use D because DRuntime. Only a subset of D can 
be used. And current problem that we have not BetterC paradigm in 
D specification. So, only crazy companies will consider D for 
large projects. Current D is successful in small console text 
routines.


If a system PL can not be used as C for highly specialized code, 
it is not a real system PL.


DRuntime and Phobos is going to compete with Java and Go. It is 
suicide for D, IMHO. In other hand, BetterC is a direction where 
D can be populated among professionals and replace C/C++.


Ilya



Re: Impressed with Appender - Is there design/implementation description?

2016-12-06 Thread Anonymouse via Digitalmars-d-learn

On Tuesday, 6 December 2016 at 10:52:44 UTC, thedeemon wrote:
It's rather simple, just take a look at its source code in 
std.array.

It's an ordinary linear array partially filled with your data.


[...]

2. Up until 4 KB it reallocates when growing, but after 4 KB 
the array lives in a larger pool of memory where it can often 
grow a lot without reallocating, so in many scenarios where 
other allocations do not interfere, the data array of appender 
grows in place without copying any data, thanks to GC.extend() 
method.


I always assumed it kept its own manually allocated array on a 
malloc heap :O


Hence a practice of using .dup and .idup on the .data member when 
you're happy with the result?


Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread Andrei Alexandrescu via Digitalmars-d-learn

On 12/5/16 3:49 PM, e-y-e wrote:

If you don't mind me saying, I think Mir could be one of the best things
for the future of D (along with LDC) and I'd be glad to help it on its way.


Yes, Mir is awesome! I keep on thinking of ways to make it better 
supported by the language and infra. -- Andrei


Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread Andrei Alexandrescu via Digitalmars-d-learn

On 12/6/16 3:28 AM, Ilya Yaroshenko wrote:

On Tuesday, 6 December 2016 at 08:14:17 UTC, Andrea Fontana wrote:

On Monday, 5 December 2016 at 20:25:00 UTC, Ilya Yaroshenko
Phobos/Druntime are pretty good for a lot of projects.


In theory


And what seem to be the issues in practice with code that is not highly 
specialized? -- Andrei


Re: Impressed with Appender - Is there design/implementation description?

2016-12-06 Thread thedeemon via Digitalmars-d-learn

On Sunday, 4 December 2016 at 20:03:37 UTC, Jon Degenhardt wrote:
I've been using Appender quite a bit recently, typically when I 
need append-only arrays with variable and unknown final sizes. 
I had been prepared to write a custom data structure when I 
started using it with large amounts of data, but very nicely 
this has not surfaced as a need. Appender has held up quite 
well.


I haven't actually benchmarked it against competing data 
structures, nor have I studied the implementation. I'd be very 
interested in understanding the design and how it compares to 
other data structures. Are there any write-ups or articles 
describing it?


--Jon


It's rather simple, just take a look at its source code in 
std.array.
It's an ordinary linear array partially filled with your data. 
When your data fills it up, it gets resized to make more space. 
Just two interesting points:


1. When it needs to grow it uses a formula like k = 1 + 10 / 
log2(newsize) for the growth factor (but with a limit of k <= 2), 
which means up to 16 KB it doubles the size each time, then tries 
to grow by a factor of 2/3, then by lower and lower factors.


2. Up until 4 KB it reallocates when growing, but after 4 KB the 
array lives in a larger pool of memory where it can often grow a 
lot without reallocating, so in many scenarios where other 
allocations do not interfere, the data array of appender grows in 
place without copying any data, thanks to GC.extend() method.


Re: Set Intersection of SortedRanges

2016-12-06 Thread Nordlöw via Digitalmars-d-learn

On Monday, 5 December 2016 at 22:10:34 UTC, Nordlöw wrote:

Has anybody already done this?


This gives good guidance on three different approaches.

http://stackoverflow.com/questions/2400157/the-intersection-of-two-sorted-arrays/4601106#4601106

Luckily we already have galloping search in Phobos :)

I'll do a couple of benchmarks.


Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread Ilya Yaroshenko via Digitalmars-d-learn

On Monday, 5 December 2016 at 20:49:50 UTC, e-y-e wrote:
On Monday, 5 December 2016 at 20:25:00 UTC, Ilya Yaroshenko 
wrote:

[...]


You know from the 15th December I will have a month of free 
time, and I would love to get myself up to speed with Mir to 
contribute to it. If you don't mind me saying, I think Mir 
could be one of the best things for the future of D (along with 
LDC) and I'd be glad to help it on its way.


Awesome! The main directions are:
 1. stdC++ analogs implementation in betterC Dlang subset
 2. betterC analogs of existing Phobos modules. We can reuse 
DRuntime / Phobos code for initial commits.

 3. Various numeric / sci software.
 4. GPU algorithms. This require dcompute to be a part of LDC.

Thank you,
Ilya



Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread Ilya Yaroshenko via Digitalmars-d-learn

On Tuesday, 6 December 2016 at 08:14:17 UTC, Andrea Fontana wrote:
On Monday, 5 December 2016 at 20:25:00 UTC, Ilya Yaroshenko 
Phobos/Druntime are pretty good for a lot of projects.


In theory


Re: [Semi-OT] I don't want to leave this language!

2016-12-06 Thread Andrea Fontana via Digitalmars-d-learn

On Monday, 5 December 2016 at 20:25:00 UTC, Ilya Yaroshenko wrote:
Good D code should be nothrow, @nogc, and betterC. BetterC 
means that it must not require DRuntime to link and to start. I 
started Mir as scientific/numeric project, but it is going to 
be a replacement for Phobos to use D instead/with of C/C++.


Completly disagree. You're speaking about scientific projects, 
maybe.

Phobos/Druntime are pretty good for a lot of projects.

Andrea