Re: Performance of tables slower than built in?

2019-05-24 Thread Basilez B. via Digitalmars-d-learn
On Thursday, 23 May 2019 at 10:16:42 UTC, Alex wrote: On Wednesday, 22 May 2019 at 08:25:58 UTC, Basile B. wrote: On Wednesday, 22 May 2019 at 00:22:09 UTC, JS wrote: I am trying to create some fast sin, sinc, and exponential routines to speed up some code by using tables... but it seems it's

Re: Using D's precise GC when running an app with DUB

2019-05-24 Thread Per Nordlöw via Digitalmars-d-learn
On Thursday, 23 May 2019 at 15:25:31 UTC, Per Nordlöw wrote: You mean wise versa, right? Nevermind that comment. No "wise versa". You're answer is correct, rikki cattermole. Thanks

Re: Performance of tables slower than built in?

2019-05-24 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Friday, 24 May 2019 at 08:33:34 UTC, Ola Fosheim Grøstad wrote: So the LUT is 3-4 times faster even with your quarter-LUT overhead. 4-5 times faster actually, since I made the LUT size known at compiletime.

Re: Performance of tables slower than built in?

2019-05-24 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Thursday, 23 May 2019 at 21:47:45 UTC, Alex wrote: Either way, sin it's still twice as fast. Also, in the code the sinTab version is missing the writeln so it would have been faster.. so it is not being optimized out. Well, when I run this modified version: https://gist.github.com/run-dlan

Re: Performance of tables slower than built in?

2019-05-24 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Friday, 24 May 2019 at 08:33:34 UTC, Ola Fosheim Grøstad wrote: https://gist.github.com/run-dlang/9f29a83b7b6754da98993063029ef93c I made an error here: "return s*((1 - f)*QuarterSinTab[ai&511] + f*QuarterSinTab[(ai+1)&511]);" Should of course be: return s*((1 - f)*QuarterSinTab[ai&511

Re: Blog Post #0038 - Dialogs IV - Saving a File

2019-05-24 Thread Ron Tarrant via Digitalmars-d-learn
Almost forgot... I also redid the titles for all posts to clarify and group them under various themes.

Blog Post #0038 - Dialogs IV - Saving a File

2019-05-24 Thread Ron Tarrant via Digitalmars-d-learn
Today's blog post over on gtkDcoding.com is about using a GTK dialog for saving a file. You can find it here: http://gtkdcoding.com/2019/05/24/0038-file-save-dialog.html

Re: Blog Post #0038 - Dialogs IV - Saving a File

2019-05-24 Thread Radu via Digitalmars-d-learn
On Friday, 24 May 2019 at 09:52:38 UTC, Ron Tarrant wrote: Today's blog post over on gtkDcoding.com is about using a GTK dialog for saving a file. You can find it here: http://gtkdcoding.com/2019/05/24/0038-file-save-dialog.html Interesting posts you have. I might not be the first one to ask

Is there a way to disable copying of an alias this'd member? - trying to make a NotNull type

2019-05-24 Thread aliak via Digitalmars-d-learn
Basically, I want this to fail: auto notNull(T, Args...)(Args args) { return NotNull!T(new T(args)); } struct NotNull(T) { private T _value; @property ref inout(T) value() inout { return this._value; } alias value this; //disable opAssign to null as well } class C {} void func(ref C

Re: Performance of tables slower than built in?

2019-05-24 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Wednesday, 22 May 2019 at 00:22:09 UTC, JS wrote: for(int i = 0; i < res; i++) QuarterSinTab[i] = sin(PI*(i/cast(double)res)); Btw, I think this creates a half sine, not a quarter, so you want (?): QuarterSinTab[i] = sin(PI*(0.5*i/cast(double)res));

Re: DLS server can't install on my pc

2019-05-24 Thread Laurent Tréguier via Digitalmars-d-learn
On Wednesday, 22 May 2019 at 12:59:13 UTC, greatsam4sure wrote: I am having some difficulty installing DLS for dlang 1.16.4 the visual studio code plugin for Dlang on my pc-windows 10 Lenovo laptop ci7. it actually install in my ci3 running windows 10. It says this app can't install on this pc.

Re: Is there a way to disable copying of an alias this'd member? - trying to make a NotNull type

2019-05-24 Thread Simen Kjærås via Digitalmars-d-learn
On Friday, 24 May 2019 at 10:16:50 UTC, aliak wrote: Basically, I want this to fail: auto notNull(T, Args...)(Args args) { return NotNull!T(new T(args)); } struct NotNull(T) { private T _value; @property ref inout(T) value() inout { return this._value; } alias value this; //disable

Re: Is there a way to disable copying of an alias this'd member? - trying to make a NotNull type

2019-05-24 Thread Simen Kjærås via Digitalmars-d-learn
On Friday, 24 May 2019 at 10:40:01 UTC, Simen Kjærås wrote: NotNull n; Typo. Should be NotNull!C n; -- Simen

Re: Blog Post #0038 - Dialogs IV - Saving a File

2019-05-24 Thread Ron Tarrant via Digitalmars-d-learn
On Friday, 24 May 2019 at 10:09:06 UTC, Radu wrote: Interesting posts you have. Thanks. I might not be the first one to ask for this, but including some screen shots when talking about UI is usually a good idea. You're right; you're not. :) I'm still debating this idea, but I won't say I'm

Re: Blog Post #0038 - Dialogs IV - Saving a File

2019-05-24 Thread Radu via Digitalmars-d-learn
On Friday, 24 May 2019 at 11:06:47 UTC, Ron Tarrant wrote: I'm still debating this idea, but I won't say I'm adamantly opposed to it. Research into how people learn seems to support both sides of the argument: should imagery be included or not? And I suppose if I ever pull all this stuff toge

Re: Is there a way to disable copying of an alias this'd member? - trying to make a NotNull type

2019-05-24 Thread aliak via Digitalmars-d-learn
On Friday, 24 May 2019 at 10:40:01 UTC, Simen Kjærås wrote: On Friday, 24 May 2019 at 10:16:50 UTC, aliak wrote: Basically, I want this to fail: auto notNull(T, Args...)(Args args) { return NotNull!T(new T(args)); } struct NotNull(T) { private T _value; @property ref inout(T) value() i

Re: Performance of tables slower than built in?

2019-05-24 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Friday, 24 May 2019 at 08:33:34 UTC, Ola Fosheim Grøstad wrote: On Thursday, 23 May 2019 at 21:47:45 UTC, Alex wrote: Either way, sin it's still twice as fast. Also, in the code the sinTab version is missing the writeln so it would have been faster.. so it is not being optimized out. Well,

Re: Performance of tables slower than built in?

2019-05-24 Thread Alex via Digitalmars-d-learn
On Friday, 24 May 2019 at 08:13:00 UTC, Basilez B. wrote: On Thursday, 23 May 2019 at 10:16:42 UTC, Alex wrote: On Wednesday, 22 May 2019 at 08:25:58 UTC, Basile B. wrote: On Wednesday, 22 May 2019 at 00:22:09 UTC, JS wrote: I am trying to create some fast sin, sinc, and exponential routines t

Re: Is there a way to disable copying of an alias this'd member? - trying to make a NotNull type

2019-05-24 Thread Simen Kjærås via Digitalmars-d-learn
On Friday, 24 May 2019 at 11:40:20 UTC, aliak wrote: It's ref so that you can do this for e.g. class C { int i; } auto a = notNull!C; a.i = 3; That's a valid concern for a struct, but classes are already reference types, so you're only adding a new layer of ref-ness. The above will work grea

Re: DLS server can't install on my pc

2019-05-24 Thread Laurent Tréguier via Digitalmars-d-learn
On Wednesday, 22 May 2019 at 12:59:13 UTC, greatsam4sure wrote: I am having some difficulty installing DLS for dlang 1.16.4 the visual studio code plugin for Dlang on my pc-windows 10 Lenovo laptop ci7. it actually install in my ci3 running windows 10. It says this app can't install on this pc.

Re: Performance of tables slower than built in?

2019-05-24 Thread Alex via Digitalmars-d-learn
On Friday, 24 May 2019 at 11:45:46 UTC, Ola Fosheim Grøstad wrote: On Friday, 24 May 2019 at 08:33:34 UTC, Ola Fosheim Grøstad wrote: On Thursday, 23 May 2019 at 21:47:45 UTC, Alex wrote: Either way, sin it's still twice as fast. Also, in the code the sinTab version is missing the writeln so it

Re: Performance of tables slower than built in?

2019-05-24 Thread Alex via Digitalmars-d-learn
On Friday, 24 May 2019 at 11:57:44 UTC, Alex wrote: On Friday, 24 May 2019 at 08:13:00 UTC, Basilez B. wrote: On Thursday, 23 May 2019 at 10:16:42 UTC, Alex wrote: On Wednesday, 22 May 2019 at 08:25:58 UTC, Basile B. wrote: On Wednesday, 22 May 2019 at 00:22:09 UTC, JS wrote: I am trying to cr

Re: Is there a way to disable copying of an alias this'd member? - trying to make a NotNull type

2019-05-24 Thread aliak via Digitalmars-d-learn
On Friday, 24 May 2019 at 12:03:08 UTC, Simen Kjærås wrote: On Friday, 24 May 2019 at 11:40:20 UTC, aliak wrote: It's ref so that you can do this for e.g. class C { int i; } auto a = notNull!C; a.i = 3; That's a valid concern for a struct, but classes are already reference types, so you're o

Re: Performance of tables slower than built in?

2019-05-24 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Friday, 24 May 2019 at 12:01:55 UTC, Alex wrote: Well, the QuarterWave was suppose to generate just a quarter since that is all that is required for these functions due to symmetry and periodicity. I started with a half to get that working then figure out the sign flipping. Sure, it is a t

Re: Performance of tables slower than built in?

2019-05-24 Thread Alex via Digitalmars-d-learn
On Friday, 24 May 2019 at 11:45:46 UTC, Ola Fosheim Grøstad wrote: On Friday, 24 May 2019 at 08:33:34 UTC, Ola Fosheim Grøstad wrote: On Thursday, 23 May 2019 at 21:47:45 UTC, Alex wrote: Either way, sin it's still twice as fast. Also, in the code the sinTab version is missing the writeln so it

Re: Performance of tables slower than built in?

2019-05-24 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Friday, 24 May 2019 at 12:24:02 UTC, Alex wrote: So it seems like a quarter-wave LUT is 27 times faster than sin… If so then that is great and what I'd expected to achieve originally. I guess this is using LDC though? I wasn't able to compile with LDC since after updating I'm getting l

Re: Performance of tables slower than built in?

2019-05-24 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Friday, 24 May 2019 at 12:56:55 UTC, Ola Fosheim Grøstad wrote: suggest above. Just beware that I haven't checked the code, so it might be off by ±1 and such. So before using such code for anything important, make sure that it is tested for the edge cases, like denormal numbers (values clo

Re: Performance of tables slower than built in?

2019-05-24 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Friday, 24 May 2019 at 12:24:02 UTC, Alex wrote: If it truly is a 27x faster then then that is very relevant and knowing why is important. Of course, a lot of that might simply be due to LDC and I wasn't able to determine this. Just one more thing you really ought to consider: It isn't o

Re: Performance of tables slower than built in?

2019-05-24 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Friday, 24 May 2019 at 11:45:46 UTC, Ola Fosheim Grøstad wrote: const double sign = cast(double)(-cast(uint)((mantissa>>63)&1)); Yep, this was wrong (0 or -1). Should be something like (1 or -1): const double sign = cast(double)(1-cast(uint)((mantissa>>62)&2)); You'll have to cod

Re: Blog Post #0038 - Dialogs IV - Saving a File

2019-05-24 Thread Ron Tarrant via Digitalmars-d-learn
On Friday, 24 May 2019 at 11:19:14 UTC, Radu wrote: But there is also the marketing effect, these posts will be more inviting for newcomers, especially ones coming from no D experience. Might worth considering even for this reason as your posts could be a powerful marketing tool for D. Yup,

Re: DLS server can't install on my pc

2019-05-24 Thread greatsam4sure via Digitalmars-d-learn
On Friday, 24 May 2019 at 12:03:37 UTC, Laurent Tréguier wrote: On Wednesday, 22 May 2019 at 12:59:13 UTC, greatsam4sure wrote: I am having some difficulty installing DLS for dlang 1.16.4 the visual studio code plugin for Dlang on my pc-windows 10 Lenovo laptop ci7. it actually install in my ci

Re: Performance of tables slower than built in?

2019-05-24 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
This appears to get roughly the same results as sin(x): __gshared double[512+1] QuarterSinTab; void init(){ const auto res = QuarterSinTab.length-1; for(int i = 0; i < res; i++) QuarterSinTab[i] = sin(PI*(0.5*i/cast(double)res)); QuarterSinTab[$-1] = sin(PI*0.5); }

Re: Performance of tables slower than built in?

2019-05-24 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
With linear interpolation you get roughly the same result with floats, a little more efficient too (half the memory and a bit faster): __gshared float[512+1] QuarterSinTab; void init(){ const auto res = QuarterSinTab.length-1; for(int i = 0; i < res; i++) QuarterSinTab[i] = sin

Re: Performance of tables slower than built in?

2019-05-24 Thread Alex via Digitalmars-d-learn
On Friday, 24 May 2019 at 13:57:30 UTC, Ola Fosheim Grøstad wrote: On Friday, 24 May 2019 at 12:24:02 UTC, Alex wrote: If it truly is a 27x faster then then that is very relevant and knowing why is important. Of course, a lot of that might simply be due to LDC and I wasn't able to determine t

Re: Performance of tables slower than built in?

2019-05-24 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Friday, 24 May 2019 at 17:04:33 UTC, Alex wrote: I'm not sure what the real precision of the build in functions are but it shouldn't be hard to max out a double using standard methods(even if slow, but irrelevant after the LUT has been created). LUTs are primarily useful when you use sin(x