Problem passing objects between threads

2012-03-26 Thread Ghislain
Hello, This question was posted in D.learn, but did not receive any answer. I apologize if this is not the right place to post. I need to pass objects of a hierarchy between threads and I have some troubles. The sample code below displays: Unknown B.fun() I do not understand why an object of t

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-26 Thread dennis luehring
try handle: http://technet.microsoft.com/de-de/sysinternals/bb896655 or process explorer: http://technet.microsoft.com/de-de/sysinternals/bb896653 to find the blocking process Am 24.03.2012 19:55, schrieb Walter Bright: Note the failure to write out test.exe. I instrumented Optlink to figure

Re: some regex vs std.ascii vs handcode times

2012-03-26 Thread Jay Norwood
On Tuesday, 27 March 2012 at 00:23:46 UTC, Juan Manuel Cabo wrote: > I downloaded and tried your benchmark. I first tried it with the ten 10Mb files that you put in github, then truncated them to 2Mb to get results comparable to the test you said did. > --jm All my times were with the 10 10MB

Re: some regex vs std.ascii vs handcode times

2012-03-26 Thread Juan Manuel Cabo
On Tuesday, 27 March 2012 at 00:23:46 UTC, Juan Manuel Cabo wrote: [] I forgot to mention that for Linux Kubuntu x64 I had to put change the type of a variable to auto in this line of wcTest.d: auto c_cnt = input.length; And that in windows7 x64, the default for dmd is -m32, so I compiled

Re: some regex vs std.ascii vs handcode times

2012-03-26 Thread Juan Manuel Cabo
On Monday, 26 March 2012 at 07:10:00 UTC, Jay Norwood wrote: On Thursday, 22 March 2012 at 04:29:41 UTC, Jay Norwood wrote: On the use of larger files ... yes that will be interesting, but for these current measurements the file reads are only taking on the order of 30ms for 20MB, which tells

digitalmars-d@puremagic.com

2012-03-26 Thread Andrei Alexandrescu
On 3/26/12 2:52 PM, Tyro[17] wrote: Couldn't the state of stdin be checked upon entrance into readf and reopened if it is already closed? That won't work. Wouldn't that accomplish the desired effect while avoiding the pitfalls of scanf? I don't think this is a pitfall. Essentially you don't

Re: Regex performance

2012-03-26 Thread Jesse Phillips
On Monday, 26 March 2012 at 22:05:34 UTC, Ali Çehreli wrote: My unofficial results comparing 2.056 to 2.058 on 64 bits: shakespeare.txt, 2.056 -> 1868 msecs shakespeare.txt, 2.058 -> 632 msecs data.csv, 2.056 -> 51953 msecs data.csv, 2.058 -> 1329 msecs That last line is pretty impressive. :

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-26 Thread Andrej Mitrovic
On 3/26/12, Walter Bright wrote: > On 3/25/2012 2:50 PM, Kagamin wrote: >> Microsoft has antivirus bundled with windows. Go to security center and >> see >> whether Windows Defender is working. > > Well, I'll be hornswoggled. That did the trick! I really don't think that's the bottom issue. I've

Re: Regex performance

2012-03-26 Thread James Miller
On 27 March 2012 11:05, Ali Çehreli wrote: > My unofficial results comparing 2.056 to 2.058 on 64 bits: > > shakespeare.txt, 2.056 -> 1868 msecs > shakespeare.txt, 2.058 ->  632 msecs > > data.csv, 2.056 -> 51953 msecs > data.csv, 2.058 ->  1329 msecs > > That last line is pretty impressive. :) D

Re: Regex performance

2012-03-26 Thread Ali Çehreli
On 03/26/2012 02:41 PM, Dmitry Olshansky wrote: > On 27.03.2012 0:27, James Blewitt wrote: >> Hello everybody, >> >> Thanks once again for the interest in my problem. I have posted the >> details and source code that recreates (at least for me) the poor >> performance. >> I didn't know how to post

Re: Regex performance

2012-03-26 Thread Dmitry Olshansky
On 27.03.2012 0:27, James Blewitt wrote: Hello everybody, Thanks once again for the interest in my problem. I have posted the details and source code that recreates (at least for me) the poor performance. I didn't know how to post the code to the forum, so I posted it to my blog instead (see pos

Re: Issue 3789, stucts equality

2012-03-26 Thread Alvaro
El 26/03/2012 13:58, bearophile escribió: Issue 3789 is an enhancement request, I think it fixes one small but quite important problem in D design. The situation is shown by this simple code: struct String { char[] data; } void main () { auto foo = String("foo".dup); auto bar =

digitalmars-d@puremagic.com

2012-03-26 Thread Ali Çehreli
On 03/26/2012 02:12 PM, Tyro[17] wrote: > I don't want to provide an explicit terminator, but instead > rely on Ctrl-D/Ctrl-Z to do the job while being able to > continue processing read request. As explained by Andrei, > this is not possible. But in my mind if the stdin stream > can be opened on

digitalmars-d@puremagic.com

2012-03-26 Thread Tyro[17]
On Monday, 26 March 2012 at 17:34:37 UTC, Ali Çehreli wrote: On 03/26/2012 04:55 AM, Tyro[17] wrote: >> > readf(" %s", &s2); // No matter how many read attempts That's the actual problem, and ironically is already known to you. :) Use a \n at the end of that format string. Thanks. I'le use c

Re: regex direct support for sse4 intrinsics

2012-03-26 Thread Timon Gehr
On 03/26/2012 09:10 PM, Dmitry Olshansky wrote: Speaking more of run-time version of regex, it is essentially running a VM that executes instructions that do various kinds of match-this, match-that. The VM dispatch code is quite slow, the optimal _threaded_ code requires either doing it in _asse

digitalmars-d@puremagic.com

2012-03-26 Thread Tyro[17]
On Monday, 26 March 2012 at 14:41:41 UTC, Andrei Alexandrescu wrote: On 3/26/12 5:55 AM, Tyro[17] wrote: You can achieve the same with: readf(" %s\n", &s2); My goal however, is not to read one line of information. Rather, it is to read multiple lines of information from standard input. I get

Re: Regex performance

2012-03-26 Thread James Blewitt
Hello everybody, Thanks once again for the interest in my problem. I have posted the details and source code that recreates (at least for me) the poor performance. I didn't know how to post the code to the forum, so I posted it to my blog instead (see post update): http://jblewitt.com/blog/

Re: Regex performance

2012-03-26 Thread Dmitry Olshansky
On 26.03.2012 20:00, Jay Norwood wrote: On Sunday, 25 March 2012 at 16:31:40 UTC, James Blewitt wrote: I'm currently trying to figure out what I'm doing differently in my original program. At this point I am assuming that I have an error in my code which causes the D program to do much more work

Re: regex direct support for sse4 intrinsics

2012-03-26 Thread Dmitry Olshansky
On 26.03.2012 22:14, Jay Norwood wrote: The sse4 capabilities include a range mode of string matching, that lets you match characters in a 16 byte string based on a 16 byte set of start and stop character ranges. See the _SIDD_CMP_RANGES mode in the table. For example, the pattern in some of ou

regex direct support for sse4 intrinsics

2012-03-26 Thread Jay Norwood
The sse4 capabilities include a range mode of string matching, that lets you match characters in a 16 byte string based on a 16 byte set of start and stop character ranges. See the _SIDD_CMP_RANGES mode in the table. For example, the pattern in some of our examples for finding the start of a wo

digitalmars-d@puremagic.com

2012-03-26 Thread Ali Çehreli
On 03/26/2012 04:55 AM, Tyro[17] wrote: >> > void main(string[] args) >> > { >> > string s1; >> > double d; >> > string s2; >> > >> > writeln("Enter a @ terminated string (multiline ok):"); >> > readf(" %s@", &s1); >> > auto arr = s1.split(); >> > >> > if (!stdin.eof()) { Ah! That's one of the p

Re: Use tango.core.Atomic.atomicLoad and atomicStore from Tango

2012-03-26 Thread Lukasz Durniat
Problem has been solved by me.

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-26 Thread Jesse Phillips
Seems like you got your answer (anti-virus). I've been struggling with this for creating a temp file, then deleting. Disabling AV isn't a solution so I have it run delete when the program exits :P Also, I've been using system("pause") to do waiting ha, if the user closes the console with the X,

Re: parallel optimizations based on number of memory controllers vs cpus

2012-03-26 Thread Jay Norwood
On Friday, 23 March 2012 at 13:56:09 UTC, Timon Gehr wrote: On program startup, do: ThreadPool.defaultPoolThreads(14); // or 13 Yes, thank you. I just tried adding that. The gains aren't scaleable in this particular test, which is apparently dominated by cpu processing, but even here you ca

Re: Regex performance

2012-03-26 Thread Jay Norwood
On Sunday, 25 March 2012 at 16:31:40 UTC, James Blewitt wrote: I'm currently trying to figure out what I'm doing differently in my original program. At this point I am assuming that I have an error in my code which causes the D program to do much more work that its Ruby counterpart (although I

Re: Use tango.core.Atomic.atomicLoad and atomicStore from Tango

2012-03-26 Thread Lukasz Durniat
Can somebody tell me what is wrong in my code?

digitalmars-d@puremagic.com

2012-03-26 Thread Andrei Alexandrescu
On 3/26/12 5:55 AM, Tyro[17] wrote: You can achieve the same with: readf(" %s\n", &s2); My goal however, is not to read one line of information. Rather, it is to read multiple lines of information from standard input. I get close to being able to do so if i don't including "\n" as a part of my

Re: Getting around the non-virtuality of templates

2012-03-26 Thread Steven Schveighoffer
On Sun, 25 Mar 2012 18:36:08 -0400, Stewart Gordon wrote: I'm coming up against some interesting challenges while porting stuff in my utility library to D2. Firstly, D2 uses opBinary and opOpAssign, rather than the operator-specific op* and op*Assign. While the latter still work, they

digitalmars-d@puremagic.com

2012-03-26 Thread Tyro[17]
First of all thank your very much for your assistance. On Sunday, 25 March 2012 at 15:04:30 UTC, Ali Çehreli wrote: On 03/25/2012 06:00 AM, Tyro[17] wrote: > I am trying to figure out the cause of my problem in the following post: > > http://forum.dlang.org/thread/qfbugjkrerfboqhvj...@forum.dla

digitalmars-d@puremagic.com

2012-03-26 Thread Tyro[17]
First of all thank your very much for your assistance. On Sunday, 25 March 2012 at 15:04:30 UTC, Ali Çehreli wrote: On 03/25/2012 06:00 AM, Tyro[17] wrote: > I am trying to figure out the cause of my problem in the following post: > > http://forum.dlang.org/thread/qfbugjkrerfboqhvj...@forum.dla

Issue 3789, stucts equality

2012-03-26 Thread bearophile
Issue 3789 is an enhancement request, I think it fixes one small but quite important problem in D design. The situation is shown by this simple code: struct String { char[] data; } void main () { auto foo = String("foo".dup); auto bar = String("foo".dup); assert(bar !is foo, "str

Re: How to use D for cross platform development?

2012-03-26 Thread Chris W.
I am using D for cross platform development. I recently implemented C wrappers for D. It works fine (Mac OS X). I could also create a Python module that consists of both D and C code (the C code is really just the wrapper for the module's functionality that is completely in D). It also works wi

Issue with module destructor order

2012-03-26 Thread Benjamin Thaut
Hi, I came across a issue with the order in which druntime calls the module destructors. I created a small repro case for it: file a.d: module a; import logger; shared static this() { log("a init"); } shared static ~this() { log("a deinit"); } file b.d: module b; import mix; class Foo

Re: some regex vs std.ascii vs handcode times

2012-03-26 Thread Jay Norwood
On Thursday, 22 March 2012 at 04:29:41 UTC, Jay Norwood wrote: On the use of larger files ... yes that will be interesting, but for these current measurements the file reads are only taking on the order of 30ms for 20MB, which tells me they are already either being cached by win7, or else by t