Re: Performance of tables slower than built in?

2019-05-25 Thread NaN via Digitalmars-d-learn
On Friday, 24 May 2019 at 17:40:40 UTC, Ola Fosheim Grøstad wrote: 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

Re: Performance of tables slower than built in?

2019-05-25 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Saturday, 25 May 2019 at 09:04:31 UTC, NaN wrote: Its pretty common technique in audio synthesis. Indeed. CSound does this. What i've done in the past is store a table of polynomial segments that were optimised with curve fitting. That's an interesting solution, how do you avoid higher

rdmd takes 2-3 seconds on a first-run of a simple .d script

2019-05-25 Thread BoQsc via Digitalmars-d-learn
rdmd is a companion to the dmd compiler that simplifies the typical edit-compile-link-run or edit-make-run cycle to a rapid edit-run cycle. Like make and other tools, rdmd uses the relative dates of the files involved to minimize the amount of work necessary. Unlike make, rdmd tracks

Re: Performance of tables slower than built in?

2019-05-25 Thread NaN via Digitalmars-d-learn
On Saturday, 25 May 2019 at 09:52:22 UTC, Ola Fosheim Grøstad wrote: On Saturday, 25 May 2019 at 09:04:31 UTC, NaN wrote: Its pretty common technique in audio synthesis. Indeed. CSound does this. What i've done in the past is store a table of polynomial segments that were optimised with

Re: Performance of tables slower than built in?

2019-05-25 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Saturday, 25 May 2019 at 12:51:20 UTC, NaN wrote: I used an evolutionary optimisation algorithm on the table all at once. So you do a weighted sum of max deviation, and 1st and 2nd order discontinuity at the joins. And minimise that across the table as a whole. It seemed you could massively

Re: Performance of tables slower than built in?

2019-05-25 Thread Danny Arends via Digitalmars-d-learn
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 slower than the function itself?!? [...] I'll just leave this here:

Re: Reuse/reset dynamic rectangular array?

2019-05-25 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-05-25 14:28:24 +, Robert M. Münch said: How can I reset a rectangualr array without having to loop through it? int[][] myRectData = new int[][](10,10); myRectData.length = 0; myRectData[].length = 0; myRectData[][].length = 0; They all give: slice expression

Re: Initializing default parameters from prior parameter

2019-05-25 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 25 May 2019 at 16:25:53 UTC, Robert M. Münch wrote: myfunc(myObj o, myType m = o.getmyTypeValue()){...} I'd probably just write it myType m = null) { if(m is null) m = o.getmyTypeValue; } or myfunc(myObj o) { /* use the default */ } myfunc(myObj o, myType m) { /* use the

Example of append & rectangualar arrays?

2019-05-25 Thread Robert M. Münch via Digitalmars-d-learn
Does anyone has an example using Appender with a rectangual array? -- Robert M. Münch http://www.saphirion.com smarter | better | faster

Initializing default parameters from prior parameter

2019-05-25 Thread Robert M. Münch via Digitalmars-d-learn
Wouldn't it make sense if this would be possible? It would shorten the function interface in cases, where no specialization of m is needed but still makes it possible to override. myfunc(myObj o, myType m = o.getmyTypeValue()){...} The compiler complains, that o is an undefined identifier.

Re: Performance of tables slower than built in?

2019-05-25 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Saturday, 25 May 2019 at 09:04:31 UTC, NaN wrote: It's bit extra work to calculate the the waveform but actual works out faster than having huge LUTs since you're typically only producing maybe 100 samples in each interrupt callback Another hybrid option when filling a buffer might be to

Re: Linking a .h file

2019-05-25 Thread Timur Gafarov via Digitalmars-d-learn
23.05.2019 13:12, infinityplusb пишет: I'm trying to use Dagon (https://github.com/gecko0307/dagon) for what I thought would be a simple enough project. Initially the one thing I needed to do was to install Nuklear and Freetype 2.8.1 `Under other OSes you have to install them manually` as I'm

Re: Performance of tables slower than built in?

2019-05-25 Thread NaN via Digitalmars-d-learn
On Friday, 24 May 2019 at 17:04:33 UTC, Alex wrote: 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

Reuse/reset dynamic rectangular array?

2019-05-25 Thread Robert M. Münch via Digitalmars-d-learn
How can I reset a rectangualr array without having to loop through it? int[][] myRectData = new int[][](10,10); myRectData.length = 0; myRectData[].length = 0; myRectData[][].length = 0; They all give: slice expression .. is not a modifiable lvalue. -- Robert M. Münch

Re: Reuse/reset dynamic rectangular array?

2019-05-25 Thread matheus via Digitalmars-d-learn
On Saturday, 25 May 2019 at 14:28:24 UTC, Robert M. Münch wrote: How can I reset a rectangualr array without having to loop through it? int[][] myRectData = new int[][](10,10); myRectData.length = 0; myRectData[].length = 0; myRectData[][].length = 0; They all give:

Re: Performance of tables slower than built in?

2019-05-25 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Saturday, 25 May 2019 at 20:07:19 UTC, NaN wrote: Its differential evolution, you can pretty much optimise anything you can quantify. http://www1.icsi.berkeley.edu/~storn/code.html Thanks, they even have Python example code. Nice.

Re: rdmd takes 2-3 seconds on a first-run of a simple .d script

2019-05-25 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 25 May 2019 at 08:32:08 UTC, BoQsc wrote: rdmd is a companion to the dmd compiler that simplifies the typical edit-compile-link-run or edit-make-run cycle to a rapid edit-run cycle. Like make and other tools, rdmd uses the relative dates of the files involved to minimize the

Re: Does slicing have an effect?

2019-05-25 Thread Max Haughton via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 20:31:58 UTC, Dennis wrote: I was replacing a memcpy with a slice assignment and accidentally used == instead of =. Usually the compiler protects me from mistakes like that: ``` int[4] a; a == a; ``` Error: a == a has no effect However, because I was using slices it

Re: Performance of tables slower than built in?

2019-05-25 Thread NaN via Digitalmars-d-learn
On Saturday, 25 May 2019 at 14:58:25 UTC, Ola Fosheim Grøstad wrote: On Saturday, 25 May 2019 at 12:51:20 UTC, NaN wrote: I used an evolutionary optimisation algorithm on the table all at once. So you do a weighted sum of max deviation, and 1st and 2nd order discontinuity at the joins. And