Re: Create many objects using threads

2014-05-05 Thread Kapps via Digitalmars-d-learn
On Monday, 5 May 2014 at 17:14:54 UTC, Caslav Sabani wrote: Hi, I have just started to learn D. Its a great language. I am trying to achieve the following but I am not sure is it possible or should be done at all: I want to have one array where I will store like 10 objects. But I

Re: Create many objects using threads

2014-05-06 Thread Kapps via Digitalmars-d-learn
On Monday, 5 May 2014 at 22:11:39 UTC, Ali Çehreli wrote: On 05/05/2014 02:38 PM, Kapps wrote: I think that the GC actually blocks when creating objects, and thus multiple threads creating instances would not provide a significant speedup, possibly even a slowdown. Wow! That is the case. :)

Re: Create many objects using threads

2014-05-06 Thread Kapps via Digitalmars-d-learn
On Tuesday, 6 May 2014 at 15:56:11 UTC, Kapps wrote: On Monday, 5 May 2014 at 22:11:39 UTC, Ali Çehreli wrote: On 05/05/2014 02:38 PM, Kapps wrote: I think that the GC actually blocks when creating objects, and thus multiple threads creating instances would not provide a significant

Re: Configuring Phobos from the 1-click installer

2014-05-12 Thread Kapps via Digitalmars-d-learn
On Monday, 12 May 2014 at 15:02:54 UTC, Moses wrote: PATH environment variable is not related at all with phobos2 sources paths. All Linux packages (Ubuntu too) includes -I/usr/include/dmd/phobos on /etc/dmd.conf configuration file. If you need to explicit pass this argument to dmd compiler,

Re: Array!T and find are slow

2014-05-14 Thread Kapps via Digitalmars-d-learn
On Wednesday, 14 May 2014 at 17:20:37 UTC, David Nadlinger wrote: On Wednesday, 14 May 2014 at 15:42:13 UTC, Damian Day wrote: On Wednesday, 14 May 2014 at 14:54:57 UTC, David Nadlinger wrote: Could you post a short benchmark snippet explicitly showing the problem? Benchmark found here:

Re: Array!T and find are slow

2014-05-14 Thread Kapps via Digitalmars-d-learn
On Wednesday, 14 May 2014 at 23:50:34 UTC, Meta wrote: On the topic of lazy, why *is* it so slow, exactly? I thought it was just shorthand for taking a function that evaluates the expression, and wrapping said expression in that function at the call site. That is, I thought that: int

Re: XamarinStudio dependency issues(Mono-D)

2014-05-15 Thread Kapps via Digitalmars-d-learn
On Friday, 16 May 2014 at 00:23:00 UTC, Jack wrote: I recently downloaded Xamarin Studio from the Mono-Develop site(as this was the only available installer on that site) and was looking to try out Mono-D. Then this showed up: http://puu.sh/8NV4V.png Was wondering where I can get those

Re: XamarinStudio dependency issues(Mono-D)

2014-05-15 Thread Kapps via Digitalmars-d-learn
On Friday, 16 May 2014 at 01:07:28 UTC, Kapps wrote: On Friday, 16 May 2014 at 00:23:00 UTC, Jack wrote: I recently downloaded Xamarin Studio from the Mono-Develop site(as this was the only available installer on that site) and was looking to try out Mono-D. Then this showed up:

Re: Class Data Members Name Reflection

2014-06-10 Thread Kapps via Digitalmars-d-learn
On Tuesday, 10 June 2014 at 16:13:31 UTC, Adam D. Ruppe wrote: Two options: do allMembers and filter it out to only be data members, or do some slicing of tupleof.stringof: S s; foreach(idx, member; s.tupleof) { writeln(Name: , s.tupleof[idx].stringof[2..$]); } The tupleof[idx] inside the

Re: Class Data Members Name Reflection

2014-06-10 Thread Kapps via Digitalmars-d-learn
On Tuesday, 10 June 2014 at 20:01:37 UTC, Nordlöw wrote: Notice that A.init.tupleof segfaults for classes so that is _not_ an adviced solution in a generic solution! There's no need to use .init: import std.stdio; struct Foo { int a, b; } void main() {

Re: Basic dynamic array question. Use of new versus no new.

2014-06-10 Thread Kapps via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 02:30:01 UTC, WhatMeWorry wrote: In Mr. Cehreli's book it says Additionally, the length of dynamic arrays can be changed by assigning a value to this property: int[] array; // initially empty array.length = 5; // now has 5 elements while in Mr. Alexandrescu's

Re: Source File and Position of User Defined Type

2014-06-11 Thread Kapps via Digitalmars-d-learn
On Tuesday, 10 June 2014 at 20:58:41 UTC, Nordlöw wrote: Is there a way to, programatically (trait), lookup the source file and position of a user defined type either dynamically or, even better, statically? I don't believe this is possible. Perhaps you would be able to generate the .json

Re: Cannot understand deprecation message recently added to Phobos

2014-06-11 Thread Kapps via Digitalmars-d-learn
On Wednesday, 11 June 2014 at 20:59:25 UTC, Nordlöw wrote: Can somebody explain the meaning of split in the error message Deprecation: function core.time.Duration.weeks is deprecated - Please use split instead. weeks was too frequently confused for total!weeks. given by function

Re: Does __gshared have shared semantics?

2014-06-13 Thread Kapps via Digitalmars-d-learn
On Saturday, 14 June 2014 at 01:24:05 UTC, Mike Franklin wrote: In other words, is 'shared __gshared' redundant? All __gshared does is makes the variable not go into thread-local storage, nothing more. Shared does this, as well as modify the type to be shared(T) instead of just T. So yes,

Re: what is going on with cgcs.c:351?

2014-06-16 Thread Kapps via Digitalmars-d-learn
Possibly https://issues.dlang.org/show_bug.cgi?id=11763 or https://issues.dlang.org/show_bug.cgi?id=11903

Re: Concurrency on Windows (spawn)

2014-06-18 Thread Kapps via Digitalmars-d-learn
On Wednesday, 18 June 2014 at 15:03:55 UTC, Ali Çehreli wrote: On 06/18/2014 06:28 AM, Chris wrote: On Wednesday, 18 June 2014 at 11:57:06 UTC, Chris wrote: Windows: in a D-DLL I'm trying to spawn a thread. However, nothing happens auto myThread = spawn(myFunction, thisTid); send(myThread,

Re: import except one?

2014-06-29 Thread Kapps via Digitalmars-d-learn
A bit late, but you should also be able to do: import scriptlike; alias Config = std.process.Config;

Re: httpS post fail at tango

2014-06-29 Thread Kapps via Digitalmars-d-learn
On Thursday, 26 June 2014 at 17:07:30 UTC, JJDuck wrote: On Thursday, 26 June 2014 at 16:33:57 UTC, JJDuck wrote: I tried to use phobos , but there is no such function exists for posting to https too With Phobos, you can use http://dlang.org/phobos/std_net_curl.html#post. Depending on

Re: Problem Linking Phobos git master

2014-07-04 Thread Kapps via Digitalmars-d-learn
Possibly something related to: https://github.com/D-Programming-Language/dmd/pull/3715 Have you tried updating to git master today?

Re: Small part of a program : d and c versions performances diff.

2014-07-09 Thread Kapps via Digitalmars-d-learn
Measure a larger number of loops. I understand you're concerned about microseconds, but your benchmark shows nothing because your timer is simply not accurate enough for this. The benchmark that bearophile showed where C took ~2 nanoseconds vs the ~7000 D took heavily implies to me that the C

Re: Small part of a program : d and c versions performances diff.

2014-07-09 Thread Kapps via Digitalmars-d-learn
On Wednesday, 9 July 2014 at 13:18:00 UTC, Larry wrote: You are definitely right, I did mess up while translating ! I run the corrected codes (the ones I was meant to provide :S) and on a slow macbook I end up with : C : 2 D : 15994 Of course when run on very high end machines, this diff is

Re: Programming a Game in D? :D

2014-08-02 Thread Kapps via Digitalmars-d-learn
On Sunday, 3 August 2014 at 03:39:25 UTC, Rikki Cattermole wrote: Lastly the game dev industry is very hesitant to change languages for a lot of reasons. And one of those is platform support. They won't be seeing D on e.g. Xbox One anytime soon if you get my drift. Apparently D already

Re: Threadpools, difference between DMD and LDC

2014-08-04 Thread Kapps via Digitalmars-d-learn
On Monday, 4 August 2014 at 05:14:22 UTC, Philippe Sigaud via Digitalmars-d-learn wrote: I have another question: it seems I can spawn hundreds of threads (Heck, even 10_000 is accepted), even when I have 4-8 cores. Is there: is there a limit to the number of threads? I tried a threadpool

Re: Can someone explain how glfw3.dll gets created?

2014-10-13 Thread Kapps via Digitalmars-d-learn
Derelict provides bindings to C libraries, and loads them at runtime. So glfw3.dll is actually an existing C library (you can get it at http://www.glfw.org/download.html), which Derelict provides bindings for. Derelict / your code does not generate the actual dll.

Re: Beginner ?. Why does D suggest to learn java

2014-10-21 Thread Kapps via Digitalmars-d-learn
On Thursday, 16 October 2014 at 22:26:51 UTC, RBfromME wrote: I'm a newbie to programming and have been looking into the D lang as a general purposing language to learn, yet the D overview indicates that java would be a better language to learn for your first programming language. Why? Looks

Re: Beginner ?. Why does D suggest to learn java

2014-10-21 Thread Kapps via Digitalmars-d-learn
On Tuesday, 21 October 2014 at 09:14:08 UTC, ketmar via Digitalmars-d-learn wrote: On Tue, 21 Oct 2014 09:01:32 + Kapps via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: no template magic that's very bad. it's time to stop making people think that templates

Re: new(malloc) locks everything in multithreading

2014-10-24 Thread Kapps via Digitalmars-d-learn
On Friday, 24 October 2014 at 10:49:42 UTC, tcak wrote: On Friday, 24 October 2014 at 10:46:57 UTC, tcak wrote: On Friday, 24 October 2014 at 10:29:10 UTC, Kagamin wrote: Looks like your IDE filters too much. Can you configure it to filter less and show address locations? This is what I have

Re: new(malloc) locks everything in multithreading

2014-10-24 Thread Kapps via Digitalmars-d-learn
On Friday, 24 October 2014 at 18:38:39 UTC, tcak wrote: On Friday, 24 October 2014 at 16:51:02 UTC, Kapps wrote: On Friday, 24 October 2014 at 10:49:42 UTC, tcak wrote: Not sure if this is the same issue, but by default gdb breaks on signals that the GC uses, which would explain why it's

Re: undefined reference to class template

2014-11-23 Thread Kapps via Digitalmars-d-learn
On Friday, 14 November 2014 at 23:29:34 UTC, Satoshi wrote: Hi, Im using GDC 4.9.0 compiler. I have template classes like public class LinkedList(T) {...} and when I try compile it together, everything works fine. But when I compile every source file to separate object file and link it

Re: [dub] Size of executable

2014-11-28 Thread Kapps via Digitalmars-d-learn
On Thursday, 27 November 2014 at 09:33:49 UTC, Chris wrote: [Maybe this has been asked before.] I usually use dub to create and build projects. I built one of the projects with dub and then by hand with dmd[1] passing all the files etc. Turned out that the executable built with dub was 1.4

Re: Check type is a struct at compile time?

2014-12-05 Thread Kapps via Digitalmars-d-learn
On Friday, 5 December 2014 at 20:38:31 UTC, Gary Willoughby wrote: How can i check that a type is a struct at compile time? I know i can test for a class like this: static if(is(T == class)) { ... } But how to do the same thing for a struct? Same thing but with struct: is(T == struct)

Re: stdio.lines doesn't have popFront, but works with foreach

2014-12-11 Thread Kapps via Digitalmars-d-learn
On Thursday, 11 December 2014 at 20:11:21 UTC, Andrew Klaassen wrote: The docs for stdio.lines say that it's a struct. stdio.lines works with foreach. The docs for foreach say: Iteration over struct and class objects can be done with ranges. For foreach, this means the following properties

Re: Shouldn't std.conv.emplace be @nogc?

2015-03-02 Thread Kapps via Digitalmars-d-learn
On Monday, 2 March 2015 at 12:37:33 UTC, drug wrote: I guess the reason why std.conv.emplace is not @nogc-ed is that nobody added it yet? I didn't see using of gc in the emplace sources. Soon: https://github.com/D-Programming-Language/phobos/pull/2999

Re: how to avoid cycle detected?

2015-07-02 Thread Kapps via Digitalmars-d-learn
On Wednesday, 1 July 2015 at 09:09:53 UTC, aki wrote: Following code causes run-time error. How can I use static this() without causing error? It's difficult to avoid this situation because actual code is more complex. file main.d: void main() { } file a.d: import b; class A { static

Re: (De)Serializing interfaces

2015-08-22 Thread Kapps via Digitalmars-d-learn
On Saturday, 22 August 2015 at 19:14:16 UTC, nims wrote: I think interfaces are very powerful and I heavily use them. The only problem I have with them is that serializing/deserializing them to XML or JSON doesn't seem to work. So far I got to try Orange and painlessjson. Using Orange all I

Re: How disruptive is the GC?

2015-07-29 Thread Kapps via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 17:09:52 UTC, Namespace wrote: On Wednesday, 29 July 2015 at 09:25:50 UTC, Snape wrote: I'm in the early stages of building a little game with OpenGL (in D) and I just want to know the facts about the GC before I decide to either use it or work around it. Lots of

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: question about the implementation of Variant

2016-01-04 Thread Kapps via Digitalmars-d-learn
On Monday, 4 January 2016 at 09:13:25 UTC, Jonathan M Davis wrote: On Monday, January 04, 2016 07:30:50 aki via Digitalmars-d-learn wrote: But wait, how does GC detect there still be a live reference to the object Foo? Because store is just a fix sized array of bytes. ubyte[size] store; GC

Re: Voldemort Type Construction Error

2016-01-15 Thread Kapps via Digitalmars-d-learn
On Friday, 15 January 2016 at 20:04:47 UTC, Nordlöw wrote: On Friday, 15 January 2016 at 16:51:24 UTC, Anon wrote: On Friday, 15 January 2016 at 14:04:50 UTC, Nordlöw wrote: What have I missed? In line 126, `static struct Result()` is a template. Either drop the parens there, or change the

Re: Is this nogc? dmd and gdc disagree

2016-02-13 Thread Kapps via Digitalmars-d-learn
On Saturday, 13 February 2016 at 00:41:35 UTC, tsbockman wrote: On Friday, 12 February 2016 at 23:46:09 UTC, Kapps wrote: You'll encounter this pretty often in Phobos I think. I really don't think @nogc is ready, and tend to avoid it in my code. Exceptions are a big reason for it, and lots of

Re: nogc Array

2016-01-25 Thread Kapps via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 04:31:07 UTC, Igor wrote: On Tuesday, 26 January 2016 at 03:06:40 UTC, maik klein wrote: On Tuesday, 26 January 2016 at 03:03:40 UTC, Igor wrote: Is there a GC-less array that we can use out of the box or do I have to create my own?

Re: Is this nogc? dmd and gdc disagree

2016-02-12 Thread Kapps via Digitalmars-d-learn
On Thursday, 11 February 2016 at 12:41:16 UTC, rcorre wrote: On Thursday, 11 February 2016 at 04:20:13 UTC, tsbockman wrote: On Thursday, 11 February 2016 at 03:09:51 UTC, rcorre wrote: I recently tried compiling enumap with GDC, and found that it disagrees with DMD on whether a function is

Re: Simple performance question from a newcomer

2016-02-21 Thread Kapps via Digitalmars-d-learn
On Monday, 22 February 2016 at 07:10:23 UTC, Kapps wrote: If you do want to test the differences between the range approach and the loop approach, something like: auto sumtest4(Range)(Range range) @safe pure { return range.reduce!((a, b) => a + b); } is a more fair comparison. I get

Re: Simple performance question from a newcomer

2016-02-21 Thread Kapps via Digitalmars-d-learn
If you do want to test the differences between the range approach and the loop approach, something like: auto sumtest4(Range)(Range range) @safe pure { return range.reduce!((a, b) => a + b); } is a more fair comparison. I get results within 15% of sumtest2 with this using dmd. I think

Re: Proper way to work around `Invalid memory operation`?

2016-09-27 Thread Kapps via Digitalmars-d-learn
On Sunday, 25 September 2016 at 16:07:12 UTC, Matthias Klumpp wrote: Hello! I have a class similar to this one: ``` class Dummy { private: string tmpDir; public: this (string fname) { tmpDir = buildPath ("/tmp", fname.baseName); std.file.mkdirRecurse (tmpDir);

Re: How to debug (potential) GC bugs?

2016-09-27 Thread Kapps via Digitalmars-d-learn
On Sunday, 25 September 2016 at 16:23:11 UTC, Matthias Klumpp wrote: Hello! I am working together with others on the D-based appstream-generator[1] project, which is generating software metadata for "software centers" and other package-manager functionality on Linux distributions, and is used

Re: an extremely naive question regarding synchronized...

2016-11-15 Thread Kapps via Digitalmars-d-learn
On Monday, 14 November 2016 at 17:43:37 UTC, WhatMeWorry wrote: I was reading this fasciniating article: https://davesdprogramming.wordpress.com/2013/05/06/low-lock-singletons/ And to quote a section of it: - static MySingleton get() {

Re: newbie problem with nothrow

2016-10-31 Thread Kapps via Digitalmars-d-learn
On Monday, 31 October 2016 at 17:04:28 UTC, Temtaime wrote: On Monday, 31 October 2016 at 16:55:51 UTC, WhatMeWorry wrote: Is there a way to turn off nothrow or work around it? Because to me it looks like nothrow prevents me from doing anything useful. extern(C) void onKeyEvent(GLFWwindow*