Re: Release D 2.071.1

2016-06-28 Thread ag0aep6g via Digitalmars-d-announce

On 06/28/2016 10:47 PM, deadalnix wrote:

On Monday, 27 June 2016 at 23:26:25 UTC, Jack Stouffer wrote:

[...]

I wouldn't call 1.0 * -1.0 == 1.0 boring!


What is this about ?


https://issues.dlang.org/show_bug.cgi?id=16027


Re: Release D 2.071.1

2016-06-28 Thread deadalnix via Digitalmars-d-announce

On Monday, 27 June 2016 at 23:26:25 UTC, Jack Stouffer wrote:
On Monday, 27 June 2016 at 23:15:06 UTC, Robert burner Schadek 
wrote:

Awesome, releases are becoming more and more boring. I like it!


I wouldn't call 1.0 * -1.0 == 1.0 boring!


What is this about ?


Re: 4x faster strlen with 4 char sentinel

2016-06-28 Thread Jay Norwood via Digitalmars-d-announce

On Tuesday, 28 June 2016 at 09:18:34 UTC, qznc wrote:
Did you also compare to strlen from libc? I'd guess GNU libc 
uses a lot more tricks like vector instructions.


I did test with the libc strlen, although the D libraries did not 
have a strlen for dchar or wchar.  I'm currently using this for 
comparison, and playing around with shorter string lengths:


nothrow pure size_t strlen(const(char)* c) {
  if (c is null )
return 0;
  const(char)* c_save = c;
  while (*c) {
c++;
  }
  return c - c_save;
}

I'm also trying some tests on a PA device where I have tools to 
look at cache hits, misses, branches mispredicted.  Similar C 
code.




Re: [Semi OT] About code review

2016-06-28 Thread Andrei Alexandrescu via Digitalmars-d-announce

On 6/26/16 8:01 PM, deadalnix wrote:

Several people during DConf asked abut tips and tricks on code review.
So I wrote an article about it:

http://www.deadalnix.me/2016/06/27/on-code-review/


Nice work. Let's see: 
https://www.reddit.com/r/programming/comments/4q9fl5/on_code_review/ -- 
Andrei


Re: 4x faster strlen with 4 char sentinel

2016-06-28 Thread Jay Norwood via Digitalmars-d-announce

On Tuesday, 28 June 2016 at 09:31:46 UTC, Sebastiaan Koppe wrote:
If we were in interview, I'd ask you "what does this returns 
if you pass it an empty string ?"


Since no one is answering:

It depends on the memory right before c. But if there is at 
least one 0 right before it - which is quite likely - then you 
get some crazy big number returned.


Yes, the test checked for 0 length but not with a preceding 0.  I 
posted the fix.


  if (c is null || *c==0)





Re: Release D 2.071.1

2016-06-28 Thread Michael via Digitalmars-d-announce

On Monday, 27 June 2016 at 23:26:25 UTC, Jack Stouffer wrote:
On Monday, 27 June 2016 at 23:15:06 UTC, Robert burner Schadek 
wrote:

Awesome, releases are becoming more and more boring. I like it!


I wouldn't call 1.0 * -1.0 == 1.0 boring!


Yeah I was thinking this haha.


IUP, CD, IM, lua interfaces in D.

2016-06-28 Thread mogu via Digitalmars-d-announce

Now IUP library collections' interfaces accomplished.

IUP(3.18):  http://code.dlang.org/packages/iupd
IM(3.10):   http://code.dlang.org/packages/imd
CD(5.9):http://code.dlang.org/packages/cdd
lua(5.3.3): http://code.dlang.org/packages/nluad

As I'm not good enough, all bindings may have many issues. Help 
me please.


All bindings do not have cpp interface conversions in D. But 
these will be the next works.


Re: 4x faster strlen with 4 char sentinel

2016-06-28 Thread Sebastiaan Koppe via Digitalmars-d-announce

On Tuesday, 28 June 2016 at 01:53:22 UTC, deadalnix wrote:

On Sunday, 26 June 2016 at 16:40:08 UTC, Jay Norwood wrote:
After watching Andre's sentinel thing, I'm playing with strlen 
on char strings with 4 terminating 0s instead of a single one.
 Seems to work and is 4x faster compared to the runtime 
version.


nothrow pure size_t strlen2(const(char)* c) {
 if (c is null)
   return 0;
 size_t l=0;
 while (*c){ c+=4; l+=4;}
 while (*c==0){ c--; l--;}
 return l+1;
}

This is the timing of my test case, which I can post if anyone 
is interested.

strlen\Release>strlen
2738
681


If we were in interview, I'd ask you "what does this returns if 
you pass it an empty string ?"


Since no one is answering:

It depends on the memory right before c. But if there is at least 
one 0 right before it - which is quite likely - then you get some 
crazy big number returned.


Re: 4x faster strlen with 4 char sentinel

2016-06-28 Thread qznc via Digitalmars-d-announce

On Sunday, 26 June 2016 at 16:40:08 UTC, Jay Norwood wrote:
After watching Andre's sentinel thing, I'm playing with strlen 
on char strings with 4 terminating 0s instead of a single one.  
Seems to work and is 4x faster compared to the runtime version.


nothrow pure size_t strlen2(const(char)* c) {
 if (c is null)
   return 0;
 size_t l=0;
 while (*c){ c+=4; l+=4;}
 while (*c==0){ c--; l--;}
 return l+1;
}

This is the timing of my test case, which I can post if anyone 
is interested.

strlen\Release>strlen
2738
681


Did you also compare to strlen from libc? I'd guess GNU libc uses 
a lot more tricks like vector instructions.


Re: Release D 2.071.1

2016-06-28 Thread Walter Bright via Digitalmars-d-announce

On 6/27/2016 3:11 PM, Martin Nowak wrote:

Glad to announce D 2.071.1.

http://dlang.org/download.html

This point release fixes a few issues over 2.071.0, see the changelog
for more details.

http://dlang.org/changelog/2.071.1.html

-Martin


Thank you, Martin!



Re: 4x faster strlen with 4 char sentinel

2016-06-28 Thread deadalnix via Digitalmars-d-announce

On Tuesday, 28 June 2016 at 03:11:26 UTC, Jay Norwood wrote:

On Tuesday, 28 June 2016 at 01:53:22 UTC, deadalnix wrote:
If we were in interview, I'd ask you "what does this returns 
if you pass it an empty string ?"


I'd say use this one instead, to avoid negative size_t. It is 
also a little faster for the same measurement.


nothrow pure size_t strlen2(const(char)* c) {
  if (c is null)
 return 0;
  const(char)* c_save = c;
  while (*c){ c+=4; }
  while (*c==0){ c--; }
  c++;
  return c - c_save;
}

2738
540
2744


If we were in an interview, I would insist.