Re: Concurrency Confusion

2015-08-07 Thread sigod via Digitalmars-d-learn
On Saturday, 8 August 2015 at 01:24:04 UTC, 岩倉 澪 wrote: On Saturday, 8 August 2015 at 00:39:57 UTC, 岩倉 澪 wrote: receiveTimeout(0.msecs, (immutable Bar[] bar){ baz = cast(Bar[])bar; }); Whoops, that should be: receiveTimeout(0.msecs, (immutable

Re: Concurrency Confusion

2015-08-07 Thread Meta via Digitalmars-d-learn
On Saturday, 8 August 2015 at 00:39:57 UTC, 岩倉 澪 wrote: Found the answer to this :) http://forum.dlang.org/post/mailman.1706.1340318206.24740.digitalmars-d-le...@puremagic.com I send the results from my worker thread with assumeUnique, and then simply cast away immutable in the receiving threa

Re: Concurrency Confusion

2015-08-07 Thread 岩倉 澪
On Saturday, 8 August 2015 at 00:39:57 UTC, 岩倉 澪 wrote: receiveTimeout(0.msecs, (immutable Bar[] bar){ baz = cast(Bar[])bar; }); Whoops, that should be: receiveTimeout(0.msecs, (immutable(Bar)[] bar){ baz = cast(Bar[])bar; });

Re: std.parallelism taskPool.map example throws exception

2015-08-07 Thread Jay Norwood via Digitalmars-d-learn
Unfortunately, this is not a very good example for std.parallelism, since the measured times are better using the std.algorithm.map calls. I know from past experience that std.parallelism routines can work well when the work is spread out correctly, so this example could be improved. This is

Re: std.parallelism taskPool.map example throws exception

2015-08-07 Thread Jay Norwood via Digitalmars-d-learn
and, finally, this works using the taskPool.map, as in the std.parallelism example. So, the trick appears to be that the call to chomp is needed. auto lineRange = File(fn).byLineCopy(); auto chomped = std.algorithm.map!"a.chomp"(lineRange); auto nums = taskPool.map!(to!

Re: Concurrency Confusion

2015-08-07 Thread 岩倉 澪
On Friday, 7 August 2015 at 22:13:35 UTC, 岩倉 澪 wrote: "message" is local to the delegate that receiveTimeout takes. I want to use "message" outside of the delegate in the receiving thread. However, if you send an immutable value from the worker thread, afaict there would be no way to assign it

Re: Using std.random.uniform as a range

2015-08-07 Thread Ali Çehreli via Digitalmars-d-learn
On 08/07/2015 06:59 AM, drug wrote: What is the best way to create range from uniform() function (in other words create a generator based on some function, returning, say, scalar, not range)? I did http://dpaste.dzfl.pl/53e3d9255cd7 but I'm not sure it's the best way. At least sequence using look

std.parallelism taskPool.map example throws exception

2015-08-07 Thread Jay Norwood via Digitalmars-d-learn
I tried to create a working example from the std.parallelism taskPool.map code, and it throws with empty strings with length 1 being passed to to!double. Anyone have a working example? I'm building on Windows with 2.067.1 dmd. import std.parallelism; import std.algorithm; import std.stdio; i

Re: Template-Parameterized Variadic isInstaceOf

2015-08-07 Thread Tofu Ninja via Digitalmars-d-learn
On Friday, 7 August 2015 at 14:45:44 UTC, Nordlöw wrote: On Friday, 7 August 2015 at 14:30:55 UTC, Nordlöw wrote: Any suggestions on adding support for `binaryFun!pred` aswell? I cracked it. template isSortedRange(T, alias pred = "a < b") { import std.traits : TemplateArgsOf; static

Re: std.parallelism example hangs compiler 2.067.1

2015-08-07 Thread Jay Norwood via Digitalmars-d-learn
On Friday, 7 August 2015 at 18:51:45 UTC, Steven Schveighoffer wrote: On 8/7/15 2:37 PM, Steven Schveighoffer wrote: I'll file a bug on this. https://issues.dlang.org/show_bug.cgi?id=14886 -Steve Thanks. The workaround works ok.

Re: std.concurrency.send problems with immutable

2015-08-07 Thread Ali Çehreli via Digitalmars-d-learn
On 08/07/2015 03:24 PM, Marek Janukowicz wrote:> This program works fine: > > import std.concurrency; > > struct A { >string a,b; > } > > void main () { >immutable A a = immutable A( "blah" ); >send( thisTid, a ); > } > > But if change struct A declaration to: > > struct A { >strin

Re: std.parallelism taskPool.map example throws exception

2015-08-07 Thread Jay Norwood via Digitalmars-d-learn
This also works. auto sm = File(fn).byLineCopy() .map!"a.chomp"() .map!(to!double) .map!"a.log10"() .sum(); writeln("sum=",sm);

std.concurrency.send problems with immutable

2015-08-07 Thread Marek Janukowicz via Digitalmars-d-learn
This program works fine: import std.concurrency; struct A { string a,b; } void main () { immutable A a = immutable A( "blah" ); send( thisTid, a ); } But if change struct A declaration to: struct A { string a,b,c; } I get this error during compilation: /opt/dmd2/linux/bin64/../../src

Re: std.parallelism taskPool.map example throws exception

2015-08-07 Thread Jay Norwood via Digitalmars-d-learn
This appears to work ... at least, no exception: auto sm = File(fn).byLine(KeepTerminator.no) .map!"a.chomp"() .map!"a.idup"() .map!(to!double) .map!"a.log10"() .sum(); writeln("sum=",sm);

Re: assigning a struct object to an array

2015-08-07 Thread Ali Çehreli via Digitalmars-d-learn
On 08/07/2015 05:37 AM, Reflexive wrote: > Is it you who wrote "Programming in D" ? Yes. (The other Ali Çehreli is a musician. :) ) > It's a great e-book, very clear, I love it. Thank you very much for the kind words. Which format are you using? It is good to hear that it is acceptable as an

Re: Concurrency Confusion

2015-08-07 Thread 岩倉 澪
On Friday, 7 August 2015 at 15:55:33 UTC, Chris wrote: To stop threads immediately, I've found that the best way is to use a shared variable, typically a bool, that is changed only in one place. ... Unfortunately, sending an abort message to a thread as in `send(thread, true)` takes too long.

Re: std.parallelism example hangs compiler 2.067.1

2015-08-07 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/7/15 2:37 PM, Steven Schveighoffer wrote: I'll file a bug on this. https://issues.dlang.org/show_bug.cgi?id=14886 -Steve

Re: std.parallelism example hangs compiler 2.067.1

2015-08-07 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/7/15 2:19 PM, Jay Norwood wrote: This appears to hang up dmd compiler 2.067.1. Changing parallel(s) to s works ok. Is this a known problem? import std.stdio; import std.string; import std.format; import std.range; import std.parallelism; int main(string[] argv) { string s[10];

std.parallelism example hangs compiler 2.067.1

2015-08-07 Thread Jay Norwood via Digitalmars-d-learn
This appears to hang up dmd compiler 2.067.1. Changing parallel(s) to s works ok. Is this a known problem? import std.stdio; import std.string; import std.format; import std.range; import std.parallelism; int main(string[] argv) { string s[10]; foreach (i, ref si ; parallel

Re: Syntax: how to return shared?

2015-08-07 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/7/15 1:19 PM, Marek Janukowicz wrote: How do I mark a function as returning shared object? This won't compile: shared Foo foo () { ... } This does, but looks somewhat awkward to me: shared (shared Foo) foo () { ... } shared, const, immutable when applied to a member function act

Re: Syntax: how to return shared?

2015-08-07 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 7 August 2015 at 17:19:16 UTC, Marek Janukowicz wrote: shared (shared Foo) foo () { ... } That's correct, though the recommendation now is to put the other shared on teh right and change the parens a little: shared(Foo) foo() shared { } The ones without parens refer to the `th

Syntax: how to return shared?

2015-08-07 Thread Marek Janukowicz via Digitalmars-d-learn
How do I mark a function as returning shared object? This won't compile: shared Foo foo () { ... } This does, but looks somewhat awkward to me: shared (shared Foo) foo () { ... } -- Marek Janukowicz

Re: std.stream.MemoryStream deprecated, range is the alternative?

2015-08-07 Thread anonymous via Digitalmars-d-learn
On Thursday, 6 August 2015 at 17:01:32 UTC, chris wrote: since memorystream is deprecated how do i do something like this with Input and Output ranges? How can i fill up an array with ranges like you can do with streams? Thanks. The InputRange primitives already exist for arrays, they are lo

Re: Concurrency Confusion

2015-08-07 Thread Chris via Digitalmars-d-learn
On Friday, 7 August 2015 at 15:55:33 UTC, Chris wrote: Using a shared boolean is probably not the "best way", I should have said the most efficient and reliable way.

Re: Concurrency Confusion

2015-08-07 Thread Chris via Digitalmars-d-learn
On Thursday, 6 August 2015 at 21:17:15 UTC, 岩倉 澪 wrote: On Tuesday, 4 August 2015 at 08:35:10 UTC, Dicebot wrote: // in real app use `receiveTimeout` to do useful stuff until // result message is received auto output = receiveOnly!(immutable(Bar)[]); New question: how would I rece

Re: Template-Parameterized Variadic isInstaceOf

2015-08-07 Thread Nordlöw
On Friday, 7 August 2015 at 14:30:55 UTC, Nordlöw wrote: Any suggestions on adding support for `binaryFun!pred` aswell? I cracked it. template isSortedRange(T, alias pred = "a < b") { import std.traits : TemplateArgsOf; static if (TemplateArgsOf!T.length == 2) { import std

Re: Template-Parameterized Variadic isInstaceOf

2015-08-07 Thread Nordlöw
On Friday, 7 August 2015 at 14:13:24 UTC, Nordlöw wrote: How do check that the second template argument to the instance of SortedRange matches `pred`? Using TemplateArgsOf. I found a solution: template isSortedRange(T, alias pred = "a < b") { import std.traits : TemplateArgsOf; enum i

Re: Template-Parameterized Variadic isInstaceOf

2015-08-07 Thread Nordlöw
On Friday, 7 August 2015 at 11:45:22 UTC, Nordlöw wrote: Can somebody please explain and help out with variadic version of `isInstanceOf`? Here's a try at isSortedRange: enum bool isSortedRange(T, alias pred = "a < b") = is(T == SortedRange!(Args[0], pred), Args...); unittest { alias R

Using std.random.uniform as a range

2015-08-07 Thread drug via Digitalmars-d-learn
What is the best way to create range from uniform() function (in other words create a generator based on some function, returning, say, scalar, not range)? I did http://dpaste.dzfl.pl/53e3d9255cd7 but I'm not sure it's the best way. At least sequence using looks ugly

Re: Creating a Priority Queue: An Adventure

2015-08-07 Thread DarthCthulhu via Digitalmars-d-learn
Okay, so, I decided to scrap the BinaryHeap version of the priority queue, going back to basics and utilizing a simple array. It works, huzzah! Code: module data_structures.priority_queue; import std.array; import std.range: assumeSorted; import std.typecons: Tuple; /* Templated Prio

Re: Template-Parameterized Variadic isInstaceOf

2015-08-07 Thread Nordlöw
On Friday, 7 August 2015 at 11:45:22 UTC, Nordlöw wrote: Can somebody please explain and help out with variadic version of `isInstanceOf`? Here's a step forward: /** Returns true if $(D T) is an instance of the template $(D T) with template parameters $(D Ps). */ enum bool isInstanceOf

ipython/jupyter notebook - idea for making it a full REPL

2015-08-07 Thread Laeeth Isharc via Digitalmars-d-learn
At the moment, thanks to John Colvin's work, you can write D in an ipython/Jupyter notebook. I find it a nicer work flow for playing around with things, since you can see results inline, and iterate rapidly. In theory maybe no better than having your editor/IDE hooked up, but the difference b

Re: Template-Parameterized Variadic isInstaceOf

2015-08-07 Thread Nicholas Wilson via Digitalmars-d-learn
On Friday, 7 August 2015 at 11:45:22 UTC, Nordlöw wrote: To implement a new trait isSortedRange(R, pred) needed for SortedRange specializations I need a variant of enum bool isInstanceOf(alias S, T) = is(T == S!Args, Args...); that takes the `pred` argument aswell. But I have no cl

Re: assigning a struct object to an array

2015-08-07 Thread Reflexive via Digitalmars-d-learn
OK, I got it. Thank you very much. Is it you who wrote "Programming in D" ? It's a great e-book, very clear, I love it. Alex

Re: zlib performance

2015-08-07 Thread Daniel Kozák via Digitalmars-d-learn
On Fri, 07 Aug 2015 12:29:26 + "yawniek" wrote: > On Friday, 7 August 2015 at 11:45:00 UTC, Daniel Kozak wrote: > > On Friday, 7 August 2015 at 09:12:32 UTC, yawniek wrote: > >> [...] > > > > Can you try it without write operation (comment out all write)? > > And than try it without uncompr

Re: zlib performance

2015-08-07 Thread yawniek via Digitalmars-d-learn
On Friday, 7 August 2015 at 11:45:00 UTC, Daniel Kozak wrote: On Friday, 7 August 2015 at 09:12:32 UTC, yawniek wrote: [...] Can you try it without write operation (comment out all write)? And than try it without uncompression? // without compression: void main(string[] args) { auto f =

Template-Parameterized Variadic isInstaceOf

2015-08-07 Thread Nordlöw
To implement a new trait isSortedRange(R, pred) needed for SortedRange specializations I need a variant of enum bool isInstanceOf(alias S, T) = is(T == S!Args, Args...); that takes the `pred` argument aswell. But I have no clue what to do with enum bool isInstanceOf(alias S, T, T

Re: Template-Parameterized Variadic isInstaceOf

2015-08-07 Thread Nordlöw
On Friday, 7 August 2015 at 11:45:22 UTC, Nordlöw wrote: enum bool isInstanceOf(alias S, T, TParams) Correction: enum bool isInstanceOf(alias S, T, TParams...)

Re: std.getopt: checking if an option has been passed

2015-08-07 Thread Laeeth Isharc via Digitalmars-d-learn
On Friday, 7 August 2015 at 11:40:54 UTC, Laeeth Isharc wrote: What's the best way to check if an (optional) argument has been passed? One way is to use a default value, but I wonder if there is a tidier approach Thanks. (For startDate and endDate below) struct NanoClientOptions { s

std.getopt: checking if an option has been passed

2015-08-07 Thread Laeeth Isharc via Digitalmars-d-learn
What's the best way to check if an (optional) argument has been passed? One way is to use a default value, but I wonder if there is a tidier approach Thanks. (For startDate and endDate below) struct NanoClientOptions { string nanoUrl="tcp://127.0.0.1:"; string[] tickers;

Re: zlib performance

2015-08-07 Thread Daniel Kozak via Digitalmars-d-learn
On Friday, 7 August 2015 at 09:12:32 UTC, yawniek wrote: On Friday, 7 August 2015 at 08:50:11 UTC, Daniel Kozák wrote: > ldc[2] -O -release -boundscheck=off -singleobj app.d ldc 0.15.2 beta2 2.86s user 0.55s system 77% cpu 4.392 total v2.068-devel-8f81ffc 2.86s user 0.67s system 78% cpu 4.47

Re: Find on sorted range slower?

2015-08-07 Thread Tofu Ninja via Digitalmars-d-learn
On Friday, 7 August 2015 at 10:01:39 UTC, Timon Gehr wrote: On 08/07/2015 11:03 AM, Tofu Ninja wrote: On Friday, 7 August 2015 at 08:18:04 UTC, Nordlöw wrote: On Friday, 7 August 2015 at 05:21:32 UTC, Tofu Ninja wrote: HAHAH wow, this is hilarious, I just checked, nothing in std.algo takes adv

Re: Find on sorted range slower?

2015-08-07 Thread Timon Gehr via Digitalmars-d-learn
On 08/07/2015 11:03 AM, Tofu Ninja wrote: On Friday, 7 August 2015 at 08:18:04 UTC, Nordlöw wrote: On Friday, 7 August 2015 at 05:21:32 UTC, Tofu Ninja wrote: HAHAH wow, this is hilarious, I just checked, nothing in std.algo takes advantage of sorted ranges, sort doesn't even take advantage of

Re: assigning a struct object to an array

2015-08-07 Thread Ali Çehreli via Digitalmars-d-learn
On 08/07/2015 02:05 AM, Reflexive wrote: > class sabot{ > carte[] sabotarray ; > > this(){ > int i ; > for (i=1 ; i<=52 ; i++){ > carte tempcarte ; > tempcarte.id = i ; > sabotarray[] ~= tempcarte ; // line 17 dmd 2.068 gives a

Re: zlib performance

2015-08-07 Thread yawniek via Digitalmars-d-learn
On Friday, 7 August 2015 at 08:50:11 UTC, Daniel Kozák wrote: > ldc[2] -O -release -boundscheck=off -singleobj app.d ldc 0.15.2 beta2 2.86s user 0.55s system 77% cpu 4.392 total v2.068-devel-8f81ffc 2.86s user 0.67s system 78% cpu 4.476 total v2.067 2.88s user 0.67s system 78% cpu 4.529 tota

assigning a struct object to an array

2015-08-07 Thread Reflexive via Digitalmars-d-learn
Hello I just began to learn D. I have some experience with Visual Basic and (very little) C/C++. Last years I have been working with PHP. So, I try to make up a class representation of a 52 cards deck. This way : // sabot.d // version 0.0.1 import std.stdio ; void main(){ auto deck

Re: Find on sorted range slower?

2015-08-07 Thread Tofu Ninja via Digitalmars-d-learn
On Friday, 7 August 2015 at 08:18:04 UTC, Nordlöw wrote: On Friday, 7 August 2015 at 05:21:32 UTC, Tofu Ninja wrote: HAHAH wow, this is hilarious, I just checked, nothing in std.algo takes advantage of sorted ranges, sort doesn't even take advantage of it! You pass a sorted range into sort and

Re: [dmd2.068] Bug or future?

2015-08-07 Thread Ali Çehreli via Digitalmars-d-learn
On 08/06/2015 11:26 PM, VlasovRoman wrote: I have some code: Filed: https://issues.dlang.org/show_bug.cgi?id=14883 Ali

Re: Find on sorted range slower?

2015-08-07 Thread Andrea Fontana via Digitalmars-d-learn
On Friday, 7 August 2015 at 08:18:04 UTC, Nordlöw wrote: On Friday, 7 August 2015 at 05:21:32 UTC, Tofu Ninja wrote: HAHAH wow, this is hilarious, I just checked, nothing in std.algo takes advantage of sorted ranges, sort doesn't even take advantage of it! You pass a sorted range into sort and

Re: zlib performance

2015-08-07 Thread Daniel Kozák via Digitalmars-d-learn
On Fri, 07 Aug 2015 08:42:45 + "yawniek" wrote: > On Friday, 7 August 2015 at 08:24:11 UTC, Daniel Kozák wrote: > > > can you try it with ldc? > > > > ldc[2] -O -release -boundscheck=off -singleobj app.d > > > ldc 0.15.2 beta2 > 2.86s user 0.55s system 77% cpu 4.392 total > > v2.068-dev

Re: zlib performance

2015-08-07 Thread yawniek via Digitalmars-d-learn
On Friday, 7 August 2015 at 08:24:11 UTC, Daniel Kozák wrote: can you try it with ldc? ldc[2] -O -release -boundscheck=off -singleobj app.d ldc 0.15.2 beta2 2.86s user 0.55s system 77% cpu 4.392 total v2.068-devel-8f81ffc 2.86s user 0.67s system 78% cpu 4.476 total v2.067 2.88s user 0.67s

Re: zlib performance

2015-08-07 Thread Daniel Kozák via Digitalmars-d-learn
On Fri, 07 Aug 2015 08:13:01 + "yawniek" wrote: > On Friday, 7 August 2015 at 08:05:01 UTC, Daniel Kozák wrote: > > import > > std.zlib, > > std.file, > > std.stdio, > > std.conv; > > > > void main(string[] args) > > { > > auto f = File(args[1], "rb"); > > auto uncompressor = new

Re: zlib performance

2015-08-07 Thread Daniel Kozák via Digitalmars-d-learn
On Fri, 07 Aug 2015 08:13:01 + "yawniek" wrote: > On Friday, 7 August 2015 at 08:05:01 UTC, Daniel Kozák wrote: > > import > > std.zlib, > > std.file, > > std.stdio, > > std.conv; > > > > void main(string[] args) > > { > > auto f = File(args[1], "rb"); > > auto uncompressor = new

Re: Find on sorted range slower?

2015-08-07 Thread Nordlöw
On Friday, 7 August 2015 at 05:21:32 UTC, Tofu Ninja wrote: HAHAH wow, this is hilarious, I just checked, nothing in std.algo takes advantage of sorted ranges, sort doesn't even take advantage of it! You pass a sorted range into sort and it will just resort it! Wow Who fixes this? I can

Re: zlib performance

2015-08-07 Thread yawniek via Digitalmars-d-learn
On Friday, 7 August 2015 at 08:05:01 UTC, Daniel Kozák wrote: import std.zlib, std.file, std.stdio, std.conv; void main(string[] args) { auto f = File(args[1], "rb"); auto uncompressor = new UnCompress(HeaderFormat.gzip); foreach (buffer; f.byChunk(4096)) { auto uncomp

Re: zlib performance

2015-08-07 Thread Daniel Kozák via Digitalmars-d-learn
On Fri, 7 Aug 2015 09:43:25 +0200 Daniel Kozák wrote: > > On Fri, 07 Aug 2015 07:36:39 + > "yawniek" wrote: > > > On Friday, 7 August 2015 at 07:29:15 UTC, Daniel Kozák wrote: > > > Which compiler and version. There has been some performance > > > problem with IO on OSX, it should be fix

Re: zlib performance

2015-08-07 Thread Daniel Kozák via Digitalmars-d-learn
On Fri, 07 Aug 2015 08:01:27 + "yawniek" wrote: > On Friday, 7 August 2015 at 07:48:25 UTC, yawniek wrote: > > On Friday, 7 August 2015 at 07:43:25 UTC, Daniel Kozák wrote: > > the fastest version i could come up so far is below. > > std.conv slows it down. > > going from a 4kb to a 4mb buff

Re: zlib performance

2015-08-07 Thread yawniek via Digitalmars-d-learn
On Friday, 7 August 2015 at 07:48:25 UTC, yawniek wrote: On Friday, 7 August 2015 at 07:43:25 UTC, Daniel Kozák wrote: the fastest version i could come up so far is below. std.conv slows it down. going from a 4kb to a 4mb buffer helped. now i'm within 30% of gzcat's performance. ok maybe not,

Re: zlib performance

2015-08-07 Thread yawniek via Digitalmars-d-learn
On Friday, 7 August 2015 at 07:43:25 UTC, Daniel Kozák wrote: i don't understand why the program crashes when i do not do the .dup This is weird. I would say it should not crash exactely. but try it yourself. the fastest version i could come up so far is below. std.conv slows it down. going f

Re: zlib performance

2015-08-07 Thread Daniel Kozák via Digitalmars-d-learn
On Fri, 07 Aug 2015 07:19:43 + "yawniek" wrote: > hi, > > unpacking files is kinda slow, probably i'm doing something wrong. > > below code is about half the speed of gnu zcat on my os x machine. > why? > > why do i need to .dup the buffer? It depends. In your case you don't need to. by

Re: zlib performance

2015-08-07 Thread Daniel Kozák via Digitalmars-d-learn
On Fri, 07 Aug 2015 07:36:39 + "yawniek" wrote: > On Friday, 7 August 2015 at 07:29:15 UTC, Daniel Kozák wrote: > > Which compiler and version. There has been some performance > > problem with IO on OSX, it should be fixed in 2.068 release > > i'm on master. v2.068-devel-8f81ffc > also cha

Re: zlib performance

2015-08-07 Thread yawniek via Digitalmars-d-learn
On Friday, 7 August 2015 at 07:29:15 UTC, Daniel Kozák wrote: Which compiler and version. There has been some performance problem with IO on OSX, it should be fixed in 2.068 release i'm on master. v2.068-devel-8f81ffc also changed file read mode to "rb". i don't understand why the program cras

Re: zlib performance

2015-08-07 Thread Daniel Kozák via Digitalmars-d-learn
On Fri, 07 Aug 2015 07:19:43 + yawniek via Digitalmars-d-learn wrote: > hi, > > unpacking files is kinda slow, probably i'm doing something wrong. > > below code is about half the speed of gnu zcat on my os x machine. > why? > > why do i need to .dup the buffer? > can i get rid of the cas

zlib performance

2015-08-07 Thread yawniek via Digitalmars-d-learn
hi, unpacking files is kinda slow, probably i'm doing something wrong. below code is about half the speed of gnu zcat on my os x machine. why? why do i need to .dup the buffer? can i get rid of the casts? the chunk size has only a marginal influence. https://github.com/yannick/zcatd import

Re: [dmd2.068] Bug or future?

2015-08-07 Thread Daniel Kozak via Digitalmars-d-learn
On Friday, 7 August 2015 at 06:26:21 UTC, VlasovRoman wrote: I have some code: import std.stdio; auto dot(T, R)(T x, R y) { return x * y; } struct Vector(T) { alias selftype = Vector!T; int len = 5; pure: const @property{ static if( is( typeof( dot( selftype.init, self