Jump to page: 1 2
Thread overview
Re: C++ vs Lisp
May 17, 2008
bearophile
May 17, 2008
Dee Girl
May 17, 2008
bearophile
May 17, 2008
Dee Girl
May 17, 2008
bearophile
May 17, 2008
Nick Sabalausky
May 17, 2008
Dee Girl
May 17, 2008
bearophile
May 18, 2008
Nick Sabalausky
May 18, 2008
janderson
May 18, 2008
Nick Sabalausky
May 18, 2008
janderson
May 18, 2008
Dee Girl
May 18, 2008
janderson
May 17, 2008
Walter Bright:
> An oldie, but some very thought provoking observations on what makes a language productive: http://faculty.cs.byu.edu/~irenelg/courses/330/CTM/Resources/C++-vs-Lisp.txt

Dear Walter, take a look at my libs, they are much better than the EasySTL he talks about: http://www.fantascienza.net/leonardo/so/libs_d.zip

This was my version of that code, written when I was a D newbie (there are things I have to learn still), 26 lines long:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=57497
With my libs it becomes even shorter/simpler.

Bye,
bearophile
May 17, 2008
bearophile Wrote:

> Walter Bright:
> > An oldie, but some very thought provoking observations on what makes a language productive: http://faculty.cs.byu.edu/~irenelg/courses/330/CTM/Resources/C++-vs-Lisp.txt
> 
> Dear Walter, take a look at my libs, they are much better than the EasySTL he talks about: http://www.fantascienza.net/leonardo/so/libs_d.zip

You have send these libraries earlier to me. Thank you for that! It looks interesting. But one problem is you use delegates. They are much slower than alias. I measured 3 - 5 times slower depending on task.

Another problem is simpler. The documentation is hard. Why you put a zip file on web and inside it has html files? It should be inverse. It would be good to put html pages on the web. Also there is no link in the html files. It is hard to understand what library is doing. I am sure the library is good. But package looks bad ^_^ Thank you, Dee Girl
May 17, 2008
Dee Girl:
> Thank you for that! It looks interesting.

My pleasure.


>But one problem is you use delegates. They are much slower than alias. I measured 3 - 5 times slower depending on task.

From my benchmarks they behave well enough, you probably talk about unusual tasks. My libs are designed for the (large!) parts of the code where you don't need max running speed. To improve the situation you may need compiler support for list comphrensions, etc and/or macros.


> The documentation is hard. Why you put a zip file on web and inside it has html files? It should be inverse. It would be good to put html pages on the web.

I see, you are right, and I can fix this problem.


> Also there is no link in the html files. It is hard to understand what library is doing.

What do you mean?
(If you spot bugs please tell me)

Bye and thank you,
bearophile
May 17, 2008
bearophile Wrote:

> Dee Girl:
> > Thank you for that! It looks interesting.
> 
> My pleasure.
> 
> 
> >But one problem is you use delegates. They are much slower than alias. I measured 3 - 5 times slower depending on task.
> 
> From my benchmarks they behave well enough, you probably talk about unusual tasks. My libs are designed for the (large!) parts of the code where you don't need max running speed. To improve the situation you may need compiler support for list comphrensions, etc and/or macros.

Simplest task was increment a value many times. On my computer is 3 times slow. Then tried simple functions like counting zeros in array of it. It was more 4 times slower. If I like this slow I code python ^_^

If there is different tradeoff to choose then I agree your argument is good. But with alias approach you have both static and dynamic. The support is already, no need for more. Why choose the bad way instead of good way?

> > The documentation is hard. Why you put a zip file on web and inside it has html files? It should be inverse. It would be good to put html pages on the web.
> 
> I see, you are right, and I can fix this problem.
> 
> 
> > Also there is no link in the html files. It is hard to understand what library is doing.
> 
> What do you mean?
> (If you spot bugs please tell me)

It is only that there is no central page. Or I can not find it. No description of all library. No links between one document and other documents. I get bored ^_^ In phobos I can easy jump from algorithm to conv or functional. Thank you, Dee Girl
May 17, 2008
"Dee Girl" <deegirl@noreply.com> wrote in message news:g0nfdd$1c2m$1@digitalmars.com...
> bearophile Wrote:
>
>> Walter Bright:
>> > An oldie, but some very thought provoking observations on what makes a language productive: http://faculty.cs.byu.edu/~irenelg/courses/330/CTM/Resources/C++-vs-Lisp.txt
>>
>> Dear Walter, take a look at my libs, they are much better than the EasySTL he talks about: http://www.fantascienza.net/leonardo/so/libs_d.zip
>
> You have send these libraries earlier to me. Thank you for that! It looks interesting. But one problem is you use delegates. They are much slower than alias. I measured 3 - 5 times slower depending on task.
>

Can you give an example of what you mean by using alias instead of delegates?


May 17, 2008
Nick Sabalausky Wrote:

> "Dee Girl" <deegirl@noreply.com> wrote in message news:g0nfdd$1c2m$1@digitalmars.com...
> > bearophile Wrote:
> >
> >> Walter Bright:
> >> > An oldie, but some very thought provoking observations on what makes a language productive: http://faculty.cs.byu.edu/~irenelg/courses/330/CTM/Resources/C++-vs-Lisp.txt
> >>
> >> Dear Walter, take a look at my libs, they are much better than the EasySTL he talks about: http://www.fantascienza.net/leonardo/so/libs_d.zip
> >
> > You have send these libraries earlier to me. Thank you for that! It looks interesting. But one problem is you use delegates. They are much slower than alias. I measured 3 - 5 times slower depending on task.
> >
> 
> Can you give an example of what you mean by using alias instead of delegates?

There was long discussion here. Maybe you did not read.

void slowbad(delegate void() f)
{
    f();
}

void fastgood(alias f)()
{
    f();
}

void main()
{
    void f() { }
    slowbad(&f);
    fastgood!(f);
}

Syntax is different but power is very different. std.algorithm uses alias always. Everybody else uses slowbad ^_^ Dee Girl
May 17, 2008
Dee Girl:
> Simplest task was increment a value many times. On my computer is 3 times slow. Then tried simple functions like counting zeros in array of it. It was more 4 times slower. If I like this slow I code python ^_^

For those very simple operations numpy is probably faster than anything you can do in D... (you probably need assembler to go a bit faster).
But compared to Python and Psyco my D libs are generally faster or much faster :-)
My libs are designed to be flexible, despite not being as fast as normal D code. In the usually very limited spots where you need max speed you can use normal D code. delegates/functions are quite more flexible than the things you talk about. And closures even more.


> It is only that there is no central page. Or I can not find it. No description of all library. No links between one document and other documents. I get bored ^_^ In phobos I can easy jump from algorithm to conv or functional. Thank you, Dee Girl

I see, and you are right, I can fix this too (currently the "central page" is the one of the 'func' module, it introduces to the whole lib).

Bye and thank you,
bearophile
May 17, 2008
Dee Girl:
> Syntax is different but power is very different. std.algorithm uses alias always. Everybody else uses slowbad ^_^ Dee Girl

D supports simple function pointers too, and just only delegates, but I see your point. I'll think about it...

Bye,
bearophile
May 18, 2008
"Dee Girl" <deegirl@noreply.com> wrote in message news:g0noqa$2rpf$1@digitalmars.com...
> There was long discussion here. Maybe you did not read.
>

Didn't see it, must have been on a different thread.

> void slowbad(delegate void() f)
> {
>    f();
> }
>
> void fastgood(alias f)()
> {
>    f();
> }
>
> void main()
> {
>    void f() { }
>    slowbad(&f);
>    fastgood!(f);
> }
>
> Syntax is different but power is very different. std.algorithm uses alias always. Everybody else uses slowbad ^_^ Dee Girl

Isn't that akin to forcing a function to be inlined? It sounds to me like, just as with normal function inlining, there are cases where that could backfire because of things like increased cache misses or increased register consumption (or are those outdated problems with inlining?).


May 18, 2008
Nick Sabalausky wrote:
> "Dee Girl" <deegirl@noreply.com> wrote in message news:g0noqa$2rpf$1@digitalmars.com...
>> There was long discussion here. Maybe you did not read.
>>
> 
> Didn't see it, must have been on a different thread.
> 
>> void slowbad(delegate void() f)
>> {
>>    f();
>> }
>>
>> void fastgood(alias f)()
>> {
>>    f();
>> }
>>
>> void main()
>> {
>>    void f() { }
>>    slowbad(&f);
>>    fastgood!(f);
>> }
>>
>> Syntax is different but power is very different. std.algorithm uses alias always. Everybody else uses slowbad ^_^ Dee Girl
> 
> Isn't that akin to forcing a function to be inlined? It sounds to me like, just as with normal function inlining, there are cases where that could backfire because of things like increased cache misses or increased register consumption (or are those outdated problems with inlining?). 
> 
> 

Only if the compiler decided to inline the contents of f function. Even then if the compiler can inline f's contents, its probably going to beable to reduce the size of the program size somewhat.  Normally the compiler is going to get it right with inlining.  The above template will boil down to:

void main()
{
   void f() { }
   slowbad(&f);  //May or maynot be inlined
   f();
}

As you can see f() is one function call less then slowbad and doesn't have to do any of the other stuff slowbad would.

-Joel
« First   ‹ Prev
1 2