Thread overview | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
July 19, 2016 Atila Neves: "C IS NOT MAGICALLY FAST, PART 2" | ||||
---|---|---|---|---|
| ||||
Posted on Atila's blog yesterday: https://atilanevesoncode.wordpress.com/2016/07/18/c-is-not-magically-fast-part-2/ |
July 19, 2016 Re: Atila Neves: "C IS NOT MAGICALLY FAST, PART 2" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Saurabh Das | On Tuesday, 19 July 2016 at 02:54:37 UTC, Saurabh Das wrote:
>
> Posted on Atila's blog yesterday:
>
> https://atilanevesoncode.wordpress.com/2016/07/18/c-is-not-magically-fast-part-2/
Where is the part one ?
|
July 19, 2016 Re: Atila Neves: "C IS NOT MAGICALLY FAST, PART 2" | ||||
---|---|---|---|---|
| ||||
Posted in reply to deadalnix | On Tuesday, 19 July 2016 at 03:03:38 UTC, deadalnix wrote: > On Tuesday, 19 July 2016 at 02:54:37 UTC, Saurabh Das wrote: >> >> Posted on Atila's blog yesterday: >> >> https://atilanevesoncode.wordpress.com/2016/07/18/c-is-not-magically-fast-part-2/ > > Where is the part one ? https://atilanevesoncode.wordpress.com/2015/08/24/c-is-not-magically-fast/ |
July 19, 2016 Re: Atila Neves: "C IS NOT MAGICALLY FAST, PART 2" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Saurabh Das | On Tuesday, 19 July 2016 at 02:54:37 UTC, Saurabh Das wrote:
>
> Posted on Atila's blog yesterday:
>
> https://atilanevesoncode.wordpress.com/2016/07/18/c-is-not-magically-fast-part-2/
So, about D vs C++ there... last night for reasons I forget I tried replacing std::string with const char* in the C++ version, and then it got faster than D. I don't know why.
At first I thought std::string was being copied instead of being moved, but some static_asserts made me doubt that. Either way, there's no good reason I can think of for C++ to magically speed up for const char*. Hmm :(
Atila
|
July 19, 2016 Re: Atila Neves: "C IS NOT MAGICALLY FAST, PART 2" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Atila Neves | On Tuesday, 19 July 2016 at 10:07:11 UTC, Atila Neves wrote:
> On Tuesday, 19 July 2016 at 02:54:37 UTC, Saurabh Das wrote:
>>
>> Posted on Atila's blog yesterday:
>>
>> https://atilanevesoncode.wordpress.com/2016/07/18/c-is-not-magically-fast-part-2/
>
> So, about D vs C++ there... last night for reasons I forget I tried replacing std::string with const char* in the C++ version, and then it got faster than D. I don't know why.
>
> At first I thought std::string was being copied instead of being moved, but some static_asserts made me doubt that. Either way, there's no good reason I can think of for C++ to magically speed up for const char*. Hmm :(
>
> Atila
What is the sizeof(Foo) for all of the cases?
What does "charPtr < charPtr" do in C++ compared to std::string?
Cheers, Jakob.
|
July 19, 2016 Re: Atila Neves: "C IS NOT MAGICALLY FAST, PART 2" | ||||
---|---|---|---|---|
| ||||
Posted in reply to deadalnix | On Tuesday, 19 July 2016 at 03:03:38 UTC, deadalnix wrote: > On Tuesday, 19 July 2016 at 02:54:37 UTC, Saurabh Das wrote: >> >> Posted on Atila's blog yesterday: >> >> https://atilanevesoncode.wordpress.com/2016/07/18/c-is-not-magically-fast-part-2/ > > Where is the part one ? https://atilanevesoncode.wordpress.com/2015/08/24/c-is-not-magically-fast/ |
July 19, 2016 Re: Atila Neves: "C IS NOT MAGICALLY FAST, PART 2" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Atila Neves | On Tuesday, 19 July 2016 at 10:07:11 UTC, Atila Neves wrote:
> On Tuesday, 19 July 2016 at 02:54:37 UTC, Saurabh Das wrote:
>>
>> Posted on Atila's blog yesterday:
>>
>> https://atilanevesoncode.wordpress.com/2016/07/18/c-is-not-magically-fast-part-2/
>
> So, about D vs C++ there... last night for reasons I forget I tried replacing std::string with const char* in the C++ version, and then it got faster than D. I don't know why.
>
> At first I thought std::string was being copied instead of being moved, but some static_asserts made me doubt that. Either way, there's no good reason I can think of for C++ to magically speed up for const char*. Hmm :(
>
> Atila
C++ Swap may be specialized for POD.
|
July 19, 2016 Re: Atila Neves: "C IS NOT MAGICALLY FAST, PART 2" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Atila Neves | Am 19.07.2016 um 12:07 schrieb Atila Neves:
> On Tuesday, 19 July 2016 at 02:54:37 UTC, Saurabh Das wrote:
>>
>> Posted on Atila's blog yesterday:
>>
>> https://atilanevesoncode.wordpress.com/2016/07/18/c-is-not-magically-fast-part-2/
>>
>
> So, about D vs C++ there... last night for reasons I forget I tried
> replacing std::string with const char* in the C++ version, and then it
> got faster than D. I don't know why.
>
> At first I thought std::string was being copied instead of being moved,
> but some static_asserts made me doubt that. Either way, there's no good
> reason I can think of for C++ to magically speed up for const char*. Hmm :(
>
> Atila
One thing that the D version does and the others don't is comparing UTF code points instead of bytes.
|
July 19, 2016 Re: Atila Neves: "C IS NOT MAGICALLY FAST, PART 2" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sönke Ludwig | On Tuesday, 19 July 2016 at 14:39:54 UTC, Sönke Ludwig wrote:
> One thing that the D version does and the others don't is comparing UTF code points instead of bytes.
Are you sure? Autodecoding is a phobos feature, but here druntime is used for string comparison, and it usually doesn't provide autodecoding.
|
July 19, 2016 Re: Atila Neves: "C IS NOT MAGICALLY FAST, PART 2" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On Tuesday, 19 July 2016 at 15:05:30 UTC, Kagamin wrote:
> On Tuesday, 19 July 2016 at 14:39:54 UTC, Sönke Ludwig wrote:
>> One thing that the D version does and the others don't is comparing UTF code points instead of bytes.
>
> Are you sure? Autodecoding is a phobos feature, but here druntime is used for string comparison, and it usually doesn't provide autodecoding.
Yeah, auto-decoding isn't at play here.
|
Copyright © 1999-2021 by the D Language Foundation