Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Fredrik Boulund via Digitalmars-d-learn
On Monday, 14 September 2015 at 12:30:21 UTC, Fredrik Boulund wrote: [...] Example output might be useful for you to see as well: 10009.1.1:5.2e-02_13: 16 10014.1.1:2.9e-03_11: 44 10017.1.1:4.1e-02_13: 16 10026.1.1:5.8e-03_12: 27 10027.1.1:6.6e-04_13: 16 10060.1.1:2.7e-03_14: 2

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Fredrik Boulund via Digitalmars-d-learn
On Monday, 14 September 2015 at 12:44:22 UTC, Edwin van Leeuwen wrote: Sounds like this program is actually IO bound. In that case I would not expect a really expect an improvement by using D. What is the CPU usage like when you run this program? Also which dmd version are you using. I think

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Andrea Fontana via Digitalmars-d-learn
On Monday, 14 September 2015 at 13:05:32 UTC, Andrea Fontana wrote: On Monday, 14 September 2015 at 12:30:21 UTC, Fredrik Boulund wrote: [...] Also if problem probabily is i/o related, have you tried with: -O -inline -release -noboundscheck ? Anyway I think it's a good idea to test it

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Andrea Fontana via Digitalmars-d-learn
On Monday, 14 September 2015 at 12:30:21 UTC, Fredrik Boulund wrote: [...] Also if problem probabily is i/o related, have you tried with: -O -inline -release -noboundscheck ? Anyway I think it's a good idea to test it against gdc and ldc that are known to generate faster executables.

Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Fredrik Boulund via Digitalmars-d-learn
Hi, This is my first post on Dlang forums and I don't have a lot of experience with D (yet). I mainly code bioinformatics-stuff in Python on my day-to-day job, but I've been toying with D for a couple of years now. I had this idea that it'd be fun to write a parser for a text-based tabular

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Monday, 14 September 2015 at 12:50:03 UTC, Fredrik Boulund wrote: On Monday, 14 September 2015 at 12:44:22 UTC, Edwin van Leeuwen wrote: Sounds like this program is actually IO bound. In that case I would not expect a really expect an improvement by using D. What is the CPU usage like when

Re: Why does reverse also flips my other dynamic array?

2015-09-14 Thread Marco Leise via Digitalmars-d-learn
Thanks for the clarification.

Re: Adjacent Pairs Range

2015-09-14 Thread Per Nordlöw via Digitalmars-d-learn
On Monday, 14 September 2015 at 05:37:05 UTC, Sebastiaan Koppe wrote: What about using zip and a slice? Slicing requires a RandomAccessRange (Array). This is too restrictive. We want to change operations such as adjacentTuples with for example map and reduce without the need for temporary

Re: Adjacent Pairs Range

2015-09-14 Thread Per Nordlöw via Digitalmars-d-learn
On Monday, 14 September 2015 at 10:45:52 UTC, Per Nordlöw wrote: restrictive. We want to change operations such as Correction: We want to *chain* operations such as...

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Monday, 14 September 2015 at 12:30:21 UTC, Fredrik Boulund wrote: Hi, Using a small test file (~550 MB) on my machine (2x Xeon(R) CPU E5-2670 with RAID6 SAS disks and 192GB of RAM), the D version runs in about 20 seconds and the Python version less than 16 seconds. I've repeated runs at

Re: chaining chain Result and underlying object of chain

2015-09-14 Thread John Colvin via Digitalmars-d-learn
On Monday, 14 September 2015 at 14:17:51 UTC, Laeeth Isharc wrote: chain doesn't seem to compile if I try and chain a chain of two strings and another string. what should I use instead? Laeeth. Works for me: http://dpaste.dzfl.pl/a692281f7a80

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Fredrik Boulund via Digitalmars-d-learn
On Monday, 14 September 2015 at 14:14:18 UTC, John Colvin wrote: what system are you on? What are the error messages you are getting? I really appreciate your will to try to help me out. This is what ldd shows on the latest binary release of LDC on my machine. I'm on a Red Hat Enterprise

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Fredrik Boulund via Digitalmars-d-learn
On Monday, 14 September 2015 at 14:15:25 UTC, Laeeth Isharc wrote: I picked up D to start learning maybe a couple of years ago. I found Ali's book, Andrei's book, github source code (including for Phobos), and asking here to be the best resources. The docs make perfect sense when you have

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread John Colvin via Digitalmars-d-learn
On Monday, 14 September 2015 at 13:58:33 UTC, Fredrik Boulund wrote: On Monday, 14 September 2015 at 13:37:18 UTC, John Colvin wrote: On Monday, 14 September 2015 at 13:05:32 UTC, Andrea Fontana wrote: On Monday, 14 September 2015 at 12:30:21 UTC, Fredrik Boulund wrote: [...] Also if

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Laeeth Isharc via Digitalmars-d-learn
On Monday, 14 September 2015 at 13:55:50 UTC, Fredrik Boulund wrote: On Monday, 14 September 2015 at 13:10:50 UTC, Edwin van Leeuwen wrote: Two things that you could try: First hitlists.byKey can be expensive (especially if hitlists is big). Instead use: foreach( key, value ; hitlists )

Re: shared array?

2015-09-14 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Monday, 14 September 2015 at 13:56:16 UTC, Laeeth Isharc wrote: Personally, when I make a strong claim about something and find that I am wrong (the claim that D needs to scan every pointer), I take a step back and consider my view rather than pressing harder. It's beautiful to be wrong

chaining chain Result and underlying object of chain

2015-09-14 Thread Laeeth Isharc via Digitalmars-d-learn
chain doesn't seem to compile if I try and chain a chain of two strings and another string. what should I use instead? Laeeth.

Re: chaining chain Result and underlying object of chain

2015-09-14 Thread cym13 via Digitalmars-d-learn
On Monday, 14 September 2015 at 14:17:51 UTC, Laeeth Isharc wrote: chain doesn't seem to compile if I try and chain a chain of two strings and another string. what should I use instead? Laeeth. std.algorithm.iteration.joiner?

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Fredrik Boulund via Digitalmars-d-learn
On Monday, 14 September 2015 at 14:28:41 UTC, John Colvin wrote: Yup, glibc is too old for those binaries. What does "ldd --version" say? It says "ldd (GNU libc) 2.12". Hmm... The most recent version in RHEL's repo is "2.12-1.166.el6_7.1", which is what is installed. Can this be side-loaded

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Sep 14, 2015 at 02:34:41PM +, Fredrik Boulund via Digitalmars-d-learn wrote: > On Monday, 14 September 2015 at 14:18:58 UTC, John Colvin wrote: > >Range-based code like you are using leads to *huge* numbers of > >function calls to get anything done. The advantage of inlining is >

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Fredrik Boulund via Digitalmars-d-learn
On Monday, 14 September 2015 at 13:05:32 UTC, Andrea Fontana wrote: On Monday, 14 September 2015 at 12:30:21 UTC, Fredrik Boulund wrote: [...] Also if problem probabily is i/o related, have you tried with: -O -inline -release -noboundscheck ? Anyway I think it's a good idea to test it

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Fredrik Boulund via Digitalmars-d-learn
On Monday, 14 September 2015 at 13:37:18 UTC, John Colvin wrote: On Monday, 14 September 2015 at 13:05:32 UTC, Andrea Fontana wrote: On Monday, 14 September 2015 at 12:30:21 UTC, Fredrik Boulund wrote: [...] Also if problem probabily is i/o related, have you tried with: -O -inline -release

Re: shared array?

2015-09-14 Thread Laeeth Isharc via Digitalmars-d-learn
On Monday, 14 September 2015 at 00:53:58 UTC, Jonathan M Davis wrote: Only the stack and the GC heap get scanned unless you tell the GC about memory that was allocated by malloc or some other mechanism. malloced memory won't be scanned by default. So, if you're using the GC minimally and

Re: how do I check if a member of a T has a member ?

2015-09-14 Thread Laeeth Isharc via Digitalmars-d-learn
On Sunday, 13 September 2015 at 17:34:11 UTC, BBasile wrote: On Sunday, 13 September 2015 at 17:24:20 UTC, Laeeth Isharc wrote: On Sunday, 13 September 2015 at 17:09:57 UTC, wobbles wrote: Use __traits(compiles, date.second)? Thanks. This works: static if (__traits(compiles, { T bar;

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread John Colvin via Digitalmars-d-learn
On Monday, 14 September 2015 at 13:50:22 UTC, Fredrik Boulund wrote: On Monday, 14 September 2015 at 13:05:32 UTC, Andrea Fontana wrote: [...] Thanks for the suggestions! I'm not too familiar with compiled languages like this, I've mainly written small programs in D and run them via `rdmd`

Re: how do I check if a member of a T has a member ?

2015-09-14 Thread John Colvin via Digitalmars-d-learn
On Monday, 14 September 2015 at 14:05:01 UTC, Laeeth Isharc wrote: On Sunday, 13 September 2015 at 17:34:11 UTC, BBasile wrote: On Sunday, 13 September 2015 at 17:24:20 UTC, Laeeth Isharc wrote: [...] can't you use 'hasMember' (either with __traits() or std.traits.hasMember)? It's more

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread John Colvin via Digitalmars-d-learn
On Monday, 14 September 2015 at 14:25:04 UTC, Fredrik Boulund wrote: On Monday, 14 September 2015 at 14:14:18 UTC, John Colvin wrote: what system are you on? What are the error messages you are getting? I really appreciate your will to try to help me out. This is what ldd shows on the latest

Re: chaining chain Result and underlying object of chain

2015-09-14 Thread anonymous via Digitalmars-d-learn
On Monday 14 September 2015 16:17, Laeeth Isharc wrote: > chain doesn't seem to compile if I try and chain a chain of two > strings and another string. > > what should I use instead? Please show code, always. A simple test works for me: import std.algorithm: equal; import std.range:

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Fredrik Boulund via Digitalmars-d-learn
On Monday, 14 September 2015 at 14:40:29 UTC, H. S. Teoh wrote: If performance is a problem, the first thing I'd recommend is to use a profiler to find out where the hotspots are. (More often than not, I have found that the hotspots are not where I expected them to be; sometimes a 1-line

Re: shared array?

2015-09-14 Thread Laeeth Isharc via Digitalmars-d-learn
On Monday, 14 September 2015 at 08:57:07 UTC, Ola Fosheim Grøstad wrote: On Monday, 14 September 2015 at 00:53:58 UTC, Jonathan M Davis wrote: So, while the fact that D's GC is less than stellar is certainly a problem, and we would definitely like to improve that, the idioms that D code

Re: shared array?

2015-09-14 Thread Laeeth Isharc via Digitalmars-d-learn
On Monday, 14 September 2015 at 13:56:16 UTC, Laeeth Isharc wrote: An associate who sold a decent sized marketing group Should read marketmaking. Making prices in listed equity options.

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Fredrik Boulund via Digitalmars-d-learn
On Monday, 14 September 2015 at 13:10:50 UTC, Edwin van Leeuwen wrote: Two things that you could try: First hitlists.byKey can be expensive (especially if hitlists is big). Instead use: foreach( key, value ; hitlists ) Also the filter.array.length is quite expensive. You could use count

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Fredrik Boulund via Digitalmars-d-learn
On Monday, 14 September 2015 at 14:18:58 UTC, John Colvin wrote: Range-based code like you are using leads to *huge* numbers of function calls to get anything done. The advantage of inlining is twofold: 1) you don't have to pay the cost of the function call itself and 2) often more

Re: Passing Elements of A Static Array as Function Parameters

2015-09-14 Thread Meta via Digitalmars-d-learn
On Monday, 14 September 2015 at 09:09:27 UTC, Per Nordlöw wrote: Is there a reason why such a common thing isn't already in Phobos? If not what about adding it to std.typecons : asTuple I guess nobody's really needed that functionality before. It might be an interesting addition to std.array.

Re: Passing Elements of A Static Array as Function Parameters

2015-09-14 Thread Meta via Digitalmars-d-learn
On Monday, 14 September 2015 at 08:56:43 UTC, Per Nordlöw wrote: BTW: What about .tupleof? Isn't that what should be used here? I don't believe .tupleof works for arrays.

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread John Colvin via Digitalmars-d-learn
On Monday, 14 September 2015 at 13:05:32 UTC, Andrea Fontana wrote: On Monday, 14 September 2015 at 12:30:21 UTC, Fredrik Boulund wrote: [...] Also if problem probabily is i/o related, have you tried with: -O -inline -release -noboundscheck ? -inline in particular is likely to have a strong

Re: Creating a DLL with a ActiveX interface.

2015-09-14 Thread Taylor Hillegeist via Digitalmars-d-learn
On Monday, 14 September 2015 at 15:20:50 UTC, Adam D. Ruppe wrote: On Monday, 14 September 2015 at 15:14:05 UTC, Taylor Hillegeist wrote: Gives a short example but the code doesn't compile for me. core\stdc\windows\com.d seems to be missing? I think the doc copy/pasted a typo there. It should

Re: chaining chain Result and underlying object of chain

2015-09-14 Thread Laeeth Isharc via Digitalmars-d-learn
On Monday, 14 September 2015 at 14:31:33 UTC, anonymous wrote: On Monday 14 September 2015 16:17, Laeeth Isharc wrote: chain doesn't seem to compile if I try and chain a chain of two strings and another string. what should I use instead? Please show code, always. A simple test works for

Re: chaining chain Result and underlying object of chain

2015-09-14 Thread anonymous via Digitalmars-d-learn
On Monday 14 September 2015 17:01, Laeeth Isharc wrote: >auto chain1 = chain("foo", "bar"); >chain1 = chain(chain1, "baz"); > > Realized that in this case it was much simpler just to use the > delegate version of toString and sink (which I had forgotten > about). But I

Re: Creating a DLL with a ActiveX interface.

2015-09-14 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 14 September 2015 at 15:14:05 UTC, Taylor Hillegeist wrote: Gives a short example but the code doesn't compile for me. core\stdc\windows\com.d seems to be missing? I think the doc copy/pasted a typo there. It should be `core.sys.windows.com`. I've done some COM stuff with D

Re: chaining chain Result and underlying object of chain

2015-09-14 Thread John Colvin via Digitalmars-d-learn
On Monday, 14 September 2015 at 15:30:14 UTC, Ali Çehreli wrote: On 09/14/2015 08:01 AM, Laeeth Isharc wrote: > I was trying to use the same variable eg > >auto chain1 = chain("foo", "bar"); >chain1 = chain(chain1, "baz"); [...] > It may be that the type of chain1 > and chain2

Re: chaining chain Result and underlying object of chain

2015-09-14 Thread Ali Çehreli via Digitalmars-d-learn
On 09/14/2015 08:01 AM, Laeeth Isharc wrote: > I was trying to use the same variable eg > >auto chain1 = chain("foo", "bar"); >chain1 = chain(chain1, "baz"); [...] > It may be that the type of chain1 > and chain2 don't mix. Exactly. I was going to recommend using pragma(msg,

Re: how do I check if a member of a T has a member ?

2015-09-14 Thread Laeeth Isharc via Digitalmars-d-learn
On Monday, 14 September 2015 at 14:21:12 UTC, John Colvin wrote: On Monday, 14 September 2015 at 14:05:01 UTC, Laeeth Isharc wrote: On Sunday, 13 September 2015 at 17:34:11 UTC, BBasile wrote: On Sunday, 13 September 2015 at 17:24:20 UTC, Laeeth Isharc wrote: [...] can't you use 'hasMember'

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread John Colvin via Digitalmars-d-learn
On Monday, 14 September 2015 at 14:35:26 UTC, Fredrik Boulund wrote: On Monday, 14 September 2015 at 14:28:41 UTC, John Colvin wrote: Yup, glibc is too old for those binaries. What does "ldd --version" say? It says "ldd (GNU libc) 2.12". Hmm... The most recent version in RHEL's repo is

Creating a DLL with a ActiveX interface.

2015-09-14 Thread Taylor Hillegeist via Digitalmars-d-learn
So, I've looked at this topic of COM OLE and activeX, and found myself confused. http://dlang.org/interface.html Gives a short example but the code doesn't compile for me. core\stdc\windows\com.d seems to be missing? And i cant find any documentation on core\stdc on the standard library page.

Re: how do I check if a member of a T has a member ?

2015-09-14 Thread John Colvin via Digitalmars-d-learn
On Monday, 14 September 2015 at 15:04:00 UTC, Laeeth Isharc wrote: On Monday, 14 September 2015 at 14:21:12 UTC, John Colvin wrote: On Monday, 14 September 2015 at 14:05:01 UTC, Laeeth Isharc wrote: On Sunday, 13 September 2015 at 17:34:11 UTC, BBasile wrote: On Sunday, 13 September 2015 at

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Monday, 14 September 2015 at 14:54:34 UTC, Fredrik Boulund wrote: On Monday, 14 September 2015 at 14:40:29 UTC, H. S. Teoh wrote: I agree with you on that. I used Python's cProfile module to find the performance bottleneck in the Python version I posted, and shaved off 8-10 seconds of

Canvas in Gtk connected to D?

2015-09-14 Thread Mike McKee via Digitalmars-d-learn
Is there a way to do a canvas in GTK3 so that I can use chart.js, and connect this to D? See, in something similar, a guy named Julien Wintz figured out that Qt's QQuickWidget acts much like the webkit Canvas object, and thus was able to port chart.js to that widget. This allows one to use Qt

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread John Colvin via Digitalmars-d-learn
On Monday, 14 September 2015 at 16:33:23 UTC, Rikki Cattermole wrote: On 15/09/15 12:30 AM, Fredrik Boulund wrote: [...] A lot of this hasn't been covered I believe. http://dpaste.dzfl.pl/f7ab2915c3e1 1) You don't need to convert char[] to string via to. No. Too much. Cast it. Not a good

Re: Creating a DLL with a ActiveX interface.

2015-09-14 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 14 September 2015 at 15:44:36 UTC, Taylor Hillegeist wrote: So, Actually I am using NI LabVIEW to interact with my DLL. I imagine even getting hold of of that would troublesome or expensive. Ah, all right. Here's a SO thing (followed up by email then copy/pasted there) I did for

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Sep 14, 2015 at 04:13:12PM +, Edwin van Leeuwen via Digitalmars-d-learn wrote: > On Monday, 14 September 2015 at 14:54:34 UTC, Fredrik Boulund wrote: > >[...] I tried using the built-in profiler in DMD on the D program but > >to no avail. I couldn't really make any sense of the output

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Rikki Cattermole via Digitalmars-d-learn
On 15/09/15 12:30 AM, Fredrik Boulund wrote: Hi, This is my first post on Dlang forums and I don't have a lot of experience with D (yet). I mainly code bioinformatics-stuff in Python on my day-to-day job, but I've been toying with D for a couple of years now. I had this idea that it'd be fun to

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread NX via Digitalmars-d-learn
On Monday, 14 September 2015 at 16:33:23 UTC, Rikki Cattermole wrote: A lot of this hasn't been covered I believe. http://dpaste.dzfl.pl/f7ab2915c3e1 I believe that should be: foreach (query, ref value; hitlists) Since an assignment happenin there..?

Re: shared array?

2015-09-14 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, September 14, 2015 01:12:02 Ola Fosheim Grostad via Digitalmars-d-learn wrote: > On Monday, 14 September 2015 at 00:41:28 UTC, Jonathan M Davis > wrote: > > Regardless, idiomatic D involves a lot more stack allocations > > than you often get even in C++, so GC usage tends to be low in

Re: reading file byLine

2015-09-14 Thread deed via Digitalmars-d-learn
On Monday, 14 September 2015 at 18:36:54 UTC, Meta wrote: As an aside, you should use `sort()` instead of the parentheses-less `sort`. The reason for this is that doing `arr.sort` invokes the old builtin array sorting which is terribly slow, whereas `import std.algorithm; arr.sort()` uses the

Re: Passing Arguments on in Variadic Functions

2015-09-14 Thread anonymous via Digitalmars-d-learn
On Monday 14 September 2015 21:59, jmh530 wrote: > This approach gives the correct result, but dmd won't deduce the > type of the template. So for instance, the second to the last > line of the unit test requires explicitly stating the types. I > may as well use the alternate version that

Re: Passing Arguments on in Variadic Functions

2015-09-14 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 14 September 2015 at 19:59:18 UTC, jmh530 wrote: In R, it is easy to have some optional inputs labeled as ... and then pass all those optional inputs in to another function. I was trying to get something similar to work in a templated D function, but I couldn't quite get the same

Re: Passing Arguments on in Variadic Functions

2015-09-14 Thread jmh530 via Digitalmars-d-learn
Thanks to you both. This works perfect.

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Sep 14, 2015 at 08:07:45PM +, Kapps via Digitalmars-d-learn wrote: > On Monday, 14 September 2015 at 18:31:38 UTC, H. S. Teoh wrote: > >I decided to give the code a spin with `gdc -O3 -pg`. Turns out that > >the hotspot is in std.array.split, contrary to expectations. :-) > >Here are

Re: Canvas in Gtk connected to D?

2015-09-14 Thread Mike McKee via Digitalmars-d-learn
On Monday, 14 September 2015 at 19:56:57 UTC, Justin Whear wrote: Mike, as this is really a GTK3 question and not specific to D (if GTK will let you do it in C, you can do it in D), you might have better success asking the GTK forum (gtkforums.com). Another avenue of research would be to look

Re: shared array?

2015-09-14 Thread Ola Fosheim Grostad via Digitalmars-d-learn
On Monday, 14 September 2015 at 20:54:55 UTC, Jonathan M Davis wrote: On Monday, September 14, 2015 01:12:02 Ola Fosheim Grostad via Digitalmars-d-learn wrote: On Monday, 14 September 2015 at 00:41:28 UTC, Jonathan M Davis wrote: > Regardless, idiomatic D involves a lot more stack >

Re: shared array?

2015-09-14 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, September 14, 2015 14:19:30 Ola Fosheim Grøstad via Digitalmars-d-learn wrote: > On Monday, 14 September 2015 at 13:56:16 UTC, Laeeth Isharc wrote: > The claim is correct: you need to follow every pointer that > through some indirection may lead to a pointer that may point > into the

Convert array to tupled array easily?

2015-09-14 Thread Prudence via Digitalmars-d-learn
I created the following code that some of you have already seen. It's sort of a multiple value AA array with self tracking. The problem is, that for some type values, such as delegates, the comparison is is identical. (basically when the delegate is the same) To solve that problem, I'd like

Re: shared array?

2015-09-14 Thread Ola Fosheim Grostad via Digitalmars-d-learn
On Monday, 14 September 2015 at 20:34:03 UTC, Jonathan M Davis wrote: I'm not sure why it wouldn't be suitable for the typical use case. It's quite performant. It would still not be suitable for many games and environments that can't afford to stop the world for more than a few milliseconds,

Re: shared array?

2015-09-14 Thread ponce via Digitalmars-d-learn
On Monday, 14 September 2015 at 20:54:55 UTC, Jonathan M Davis wrote: So, you _can_ have low heap allocation in a C++ program, and many people do, but from what I've seen, that really isn't the norm across the C++ community in general. - Jonathan M Davis Fully agreed, C++ in the wild

Re: Convert array to tupled array easily?

2015-09-14 Thread Ali Çehreli via Digitalmars-d-learn
On 09/14/2015 04:23 PM, Prudence wrote: > To solve that problem, I'd like to try and turn the Value into Tuples of > the Value and the address of the SingleStore wrapper(which should be > unique). > > e.g., > public Tuple!(TValue, void*)[][TKey] Store; After changing that, I methodically dealt

Re: Canvas in Gtk connected to D?

2015-09-14 Thread Mike McKee via Digitalmars-d-learn
On Monday, 14 September 2015 at 21:57:23 UTC, Mike McKee wrote: I'll ask in the GTK Forums what they recommend as the most recently recommended approach for doing static charts in GTK3. BTW, the gtkforums.com site doesn't just let anyone in. I'm still waiting on an admin to approve me. :(

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Rikki Cattermole via Digitalmars-d-learn
On 15/09/15 5:41 AM, NX wrote: On Monday, 14 September 2015 at 16:33:23 UTC, Rikki Cattermole wrote: A lot of this hasn't been covered I believe. http://dpaste.dzfl.pl/f7ab2915c3e1 I believe that should be: foreach (query, ref value; hitlists) Since an assignment happenin there..?

Re: D + Dub + Sublime +... build/run in terminal?

2015-09-14 Thread Laeeth Isharc via Digitalmars-d-learn
On Sunday, 13 September 2015 at 10:00:13 UTC, SuperLuigi wrote: Just wondering if anyone here might know how I can accomplish this... basically I'm editing my D code in Sublime using the Dkit plugin to access DCD which so far is more reliable than monodevelop's autocomplete but I do need to

Re: Combining Unique type with concurrency module

2015-09-14 Thread Alex via Digitalmars-d-learn
On Monday, 14 September 2015 at 00:11:07 UTC, Ali Çehreli wrote: On 09/13/2015 09:09 AM, Alex wrote: > I'm new to this forum so, please excuse me in advance for > asking silly questions. Before somebody else says it: There are no silly questions. :) > struct std.typecons.Unique!(S).Unique is

Re: Passing Elements of A Static Array as Function Parameters

2015-09-14 Thread Meta via Digitalmars-d-learn
On Monday, 14 September 2015 at 05:18:00 UTC, Nordlöw wrote: If I have a static array `x` defined as enum N = 3; int[N] x; how do I pass it's elements into a variadic function f(T...)(T xs) if (T.length >= 3) ? You could turn it into a Tuple and use the `expand` method to get

Re: Combining Unique type with concurrency module

2015-09-14 Thread Dicebot via Digitalmars-d-learn
On Monday, 14 September 2015 at 00:11:07 UTC, Ali Çehreli wrote: There is a misconception. Unique guarantees that the object will not be copied. It does not provide any guarantee that only one thread will access the object. It is possible to write a type that acquires a lock during certain

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread CraigDillabaugh via Digitalmars-d-learn
On Monday, 14 September 2015 at 12:30:21 UTC, Fredrik Boulund wrote: Hi, This is my first post on Dlang forums and I don't have a lot of experience with D (yet). I mainly code bioinformatics-stuff in Python on my day-to-day job, but I've been toying with D for a couple of years now. I had

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread John Colvin via Digitalmars-d-learn
On Monday, 14 September 2015 at 17:51:43 UTC, CraigDillabaugh wrote: On Monday, 14 September 2015 at 12:30:21 UTC, Fredrik Boulund wrote: [...] I am going to go off the beaten path here. If you really want speed for a file like this one way of getting that is to read the file in as a

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread H. S. Teoh via Digitalmars-d-learn
I decided to give the code a spin with `gdc -O3 -pg`. Turns out that the hotspot is in std.array.split, contrary to expectations. :-) Here are the first few lines of the gprof output: -snip- Each sample counts as 0.01 seconds. % cumulative self self total

Re: reading file byLine

2015-09-14 Thread Meta via Digitalmars-d-learn
On Monday, 7 September 2015 at 10:25:09 UTC, deed wrote: Right, it's like int x = 3; // x + 5; // Just an expression evaluated to 8, // but what do you want to do with it? // It won't affect your program and the // compiler will give you an

Re: Canvas in Gtk connected to D?

2015-09-14 Thread Justin Whear via Digitalmars-d-learn
On Mon, 14 Sep 2015 17:05:16 +, Mike McKee wrote: > Is there a way to do a canvas in GTK3 so that I can use chart.js, Mike, as this is really a GTK3 question and not specific to D (if GTK will let you do it in C, you can do it in D), you might have better success asking the GTK forum

Passing Arguments on in Variadic Functions

2015-09-14 Thread jmh530 via Digitalmars-d-learn
In R, it is easy to have some optional inputs labeled as ... and then pass all those optional inputs in to another function. I was trying to get something similar to work in a templated D function, but I couldn't quite get the same behavior. What I have below is what I was able to get working.

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread Kapps via Digitalmars-d-learn
On Monday, 14 September 2015 at 18:31:38 UTC, H. S. Teoh wrote: I decided to give the code a spin with `gdc -O3 -pg`. Turns out that the hotspot is in std.array.split, contrary to expectations. :-) Here are the first few lines of the gprof output: [...] Perhaps using the new rangified

Re: Canvas in Gtk connected to D?

2015-09-14 Thread Alexander Hausmann via Digitalmars-d-learn
Am 14.09.2015 um 19:05 schrieb Mike McKee: > Is there a way to do a canvas in GTK3 so that I can use chart.js, and > connect this to D? See, in something similar, a guy named Julien Wintz > figured out that Qt's QQuickWidget acts much like the webkit Canvas > object, and thus was able to port

Re: Combining Unique type with concurrency module

2015-09-14 Thread Ali Çehreli via Digitalmars-d-learn
On 09/14/2015 12:07 AM, Alex wrote: > Do you have a hint how to create such a type? The needed operation is > "onPassingTo" another thread. So the idea is to create a resource, which > is not really shared (a question of definition, I think), as it should > be accessible only from one thread at

Re: Passing Elements of A Static Array as Function Parameters

2015-09-14 Thread Per Nordlöw via Digitalmars-d-learn
On Monday, 14 September 2015 at 07:05:23 UTC, Meta wrote: You could turn it into a Tuple and use the `expand` method to get a TypeTuple (AliasSeq). import std.typecons; import std.typetuple; import std.stdio; template genTypeList(T, size_t n) { static if (n <= 1) {

Re: Combining Unique type with concurrency module

2015-09-14 Thread Dicebot via Digitalmars-d-learn
On Monday, 14 September 2015 at 00:11:07 UTC, Ali Çehreli wrote: send(childTid2, cast(shared(Unique!S*))); And yeah this violates the idea of Unique. Sadly, I am not aware of any way to prohibit taking address of an aggregate.

Re: shared array?

2015-09-14 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Monday, 14 September 2015 at 00:53:58 UTC, Jonathan M Davis wrote: So, while the fact that D's GC is less than stellar is certainly a problem, and we would definitely like to improve that, the idioms that D code typically uses seriously reduce the number of performance problems that we get.

Re: Passing Elements of A Static Array as Function Parameters

2015-09-14 Thread Per Nordlöw via Digitalmars-d-learn
On Monday, 14 September 2015 at 07:05:23 UTC, Meta wrote: You could turn it into a Tuple and use the `expand` method to get a TypeTuple (AliasSeq). import std.typecons; import std.typetuple; import std.stdio; template genTypeList(T, size_t n) { static if (n <= 1) {