Re: speeding up + ctfe question

2012-05-27 Thread jerro
On Sunday, 27 May 2012 at 17:00:01 UTC, maarten van damme wrote: ok, can't seem to reproduce the crashing. now on to optimizing my sieve a bit more ,9 miliseconds for 1_000_000 is still to slow. -- Er is zon buiten. Zonnige zondag namiddag met priemgetallen in de plaats van buiten zitten. Tss

Re: Limit number of compiler error messages

2012-05-27 Thread cal
On Sunday, 27 May 2012 at 18:31:53 UTC, Stewart Gordon wrote: What version of Windows are you using? Modern versions support 2> to redirect stderr to a file. But 2| doesn't seem to work correspondingly (at least under Vista, don't know about Win7) - by the looks of it it just passes 2 as an

Re: Limit number of compiler error messages

2012-05-27 Thread Stewart Gordon
On 22/05/2012 18:36, cal wrote: 2>&1 | head -n Where is your dmd/rdmd/build script command. There's probably something similar you could use on Windows, I don't really know though. By "something similar" do you mean a way of piping stderr, or a head utility? A head utility is trivial to c

Re: BitArray - Is there one?

2012-05-27 Thread Jonathan M Davis
On Sunday, May 27, 2012 20:21:23 Era Scarecrow wrote: > On Sunday, 27 May 2012 at 18:18:13 UTC, Era Scarecrow wrote: > > On Sunday, 27 May 2012 at 17:26:33 UTC, Chris Cain wrote: > >> And also std.container.Array ... it has a specialization that > >> packs bools. It also appears to be more modern.

Re: BitArray - Is there one?

2012-05-27 Thread Era Scarecrow
On Sunday, 27 May 2012 at 18:18:13 UTC, Era Scarecrow wrote: On Sunday, 27 May 2012 at 17:26:33 UTC, Chris Cain wrote: And also std.container.Array ... it has a specialization that packs bools. It also appears to be more modern. Unfortunately I'm not following, either in the documentation or

Re: BitArray - Is there one?

2012-05-27 Thread Era Scarecrow
On Sunday, 27 May 2012 at 17:26:33 UTC, Chris Cain wrote: And also std.container.Array ... it has a specialization that packs bools. It also appears to be more modern. Unfortunately I'm not following, either in the documentation or glancing over the sources.

Re: BitArray - Is there one?

2012-05-27 Thread Chris Cain
On Sunday, 27 May 2012 at 06:53:33 UTC, Alex Rønne Petersen wrote: std.bitmanip.BitArray. And also std.container.Array ... it has a specialization that packs bools. It also appears to be more modern.

Re: speeding up + ctfe question

2012-05-27 Thread maarten van damme
ok, can't seem to reproduce the crashing. now on to optimizing my sieve a bit more ,9 miliseconds for 1_000_000 is still to slow. -- Er is zon buiten. Zonnige zondag namiddag met priemgetallen in de plaats van buiten zitten. Tss tss. :-) hoe? wie? x)

Re: Windows - ZeroMemory macro

2012-05-27 Thread Andrej Mitrovic
On 5/27/12, dnewbie wrote: > In C I can write > > OPENFILENAME ofn; > ZeroMemory(&ofn, sizeof(ofn)); > > In D, there is no ZeroMemory. Please help me. > I've never had to use this with WinAPI. The default .init value usually works well, especially if the struct is well-defined, e.g.: struct Foo

Re: Struct hash issues with string fields

2012-05-27 Thread Ali Çehreli
On 05/27/2012 04:22 AM, Andrej Mitrovic wrote: On 5/27/12, Ali Çehreli wrote: On 05/26/2012 05:13 PM, Ali Çehreli wrote: > once you define toHash(), you > must also define opCmp() and opEquals() that are all consistent with > each other. Correction: opEquals() is only for potential o

Re: Windows - ZeroMemory macro

2012-05-27 Thread dnewbie
On Sunday, 27 May 2012 at 03:55:58 UTC, jerro wrote: On Sunday, 27 May 2012 at 03:29:17 UTC, dnewbie wrote: In C I can write OPENFILENAME ofn; ZeroMemory(&ofn, sizeof(ofn)); In D, there is no ZeroMemory. Please help me. You could use c memset: import std.c.string; memset(cast(void*)&ofn, 0,

Re: speeding up + ctfe question

2012-05-27 Thread jerro
I ran in two problems. It was extremely fast when sieving a byte array of 1 million entries (without optimizations at all) but when trying with 10_000_000 entries the program crashes before it even starts to execute (main isn't reached). You say it does compile, but then crashes immediatly? I

Re: speeding up + ctfe question

2012-05-27 Thread sclytrack
On 05/27/2012 02:10 PM, maarten van damme wrote: thank you :) I wrote a sieve of aristotle because atkin's sieve needed waay to many optimizations to beat aristotle's sieve by even a little bit so I wanted to see if aristotle's was good enough. I ran in two problems. It was extremely fast when

Re: speeding up + ctfe question

2012-05-27 Thread maarten van damme
thank you :) I wrote a sieve of aristotle because atkin's sieve needed waay to many optimizations to beat aristotle's sieve by even a little bit so I wanted to see if aristotle's was good enough. I ran in two problems. It was extremely fast when sieving a byte array of 1 million entries (without

Re: speeding up + ctfe question

2012-05-27 Thread sclytrack
On 05/27/2012 01:18 PM, maarten van damme wrote: well, maybe, looking back at it, a range isn't the ideal way to go about generating primes easily. I'm going to implement the sieve of Atkin and make it return an array of primes up to a given number. This might be a bit more useful and fast. Is t

Re: Struct hash issues with string fields

2012-05-27 Thread Andrej Mitrovic
On 5/27/12, Ali Çehreli wrote: > On 05/26/2012 05:13 PM, Ali Çehreli wrote: > > > once you define toHash(), you > > must also define opCmp() and opEquals() that are all consistent with > > each other. > > Correction: opEquals() is only for potential optimizations. What is > needed alongside toH

Re: speeding up + ctfe question

2012-05-27 Thread maarten van damme
well, maybe, looking back at it, a range isn't the ideal way to go about generating primes easily. I'm going to implement the sieve of Atkin and make it return an array of primes up to a given number. This might be a bit more useful and fast. Is there somewhere I can catch up on ctfe? after readin

Re: Simplified socket creation and handling

2012-05-27 Thread Jarl André
Sorry for the typo: I do NOT understand it completely. Thanks for the feedback! Well, for me I am a Java enterprise developer working with Java on Unix, but, I have worked with .NET in the past giving me a tiny portion of mercy to those that enjoys Visual Studio :) Its actually a blazing fast

Re: Translating C const

2012-05-27 Thread Jacob Carlborg
That seems like a good approach, since then you're not marking things as const in D that C would consider mutable and therefore be likely to be altered, breaking D's guarantees. It does make me think that it could be valuable to include a comment with the original declaration though (at least in

Re: Simplified socket creation and handling

2012-05-27 Thread Jarl André
On Friday, 25 May 2012 at 20:55:12 UTC, Donald Duvall wrote: On Friday, 25 May 2012 at 20:50:25 UTC, Donald Duvall wrote: On Wednesday, 23 May 2012 at 19:24:53 UTC, Jarl André wrote: On Wednesday, 23 May 2012 at 13:39:09 UTC, Jarl André wrote: On Saturday, 19 May 2012 at 20:33:49 UTC, Nathan M.

Re: BitArray - Is there one?

2012-05-27 Thread bearophile
Era Scarecrow: I'll go over it and see what I can do. Take also a look in Bugzilla, there are few small enhancement requests about BitArray (like a fast population count method). Bye, bearophile

Re: BitArray - Is there one?

2012-05-27 Thread Era Scarecrow
On Sunday, 27 May 2012 at 07:04:36 UTC, Alex Rønne Petersen wrote: It could definitely use some improvement. In particular: * It still uses the deprecated operator overload methods, rather than opBinary(Right) and opUnary. * It's not quite const/immutable-friendly. * It forces the GC on you. P

Re: BitArray - Is there one?

2012-05-27 Thread Alex Rønne Petersen
On 27-05-2012 08:58, Era Scarecrow wrote: On Sunday, 27 May 2012 at 06:53:33 UTC, Alex Rønne Petersen wrote: std.bitmanip.BitArray. And I was certain I checked std.bitmanip. Oh well, I'll throw my current unittests at it and perhaps improve what's already avaliable if it needs it. It could d

Re: BitArray - Is there one?

2012-05-27 Thread Era Scarecrow
On Sunday, 27 May 2012 at 06:58:21 UTC, Era Scarecrow wrote: On Sunday, 27 May 2012 at 06:53:33 UTC, Alex Rønne Petersen wrote: std.bitmanip.BitArray. And I was certain I checked std.bitmanip. Oh well, I'll throw my current unittests at it and perhaps improve what's already avaliable if it

Re: BitArray - Is there one?

2012-05-27 Thread Era Scarecrow
On Sunday, 27 May 2012 at 06:53:33 UTC, Alex Rønne Petersen wrote: std.bitmanip.BitArray. And I was certain I checked std.bitmanip. Oh well, I'll throw my current unittests at it and perhaps improve what's already avaliable if it needs it.