Re: Performance of tables slower than built in?

2019-05-23 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Thursday, 23 May 2019 at 21:50:38 UTC, Alex wrote: I've used very small LUT's like a length of 5 and it didn't significantly change anything. Use a size that is 2^n, then mask the index and hopefully that will turn off bounds checks. E.g. If LUT size is 16, then index the lut with

Re: Performance of tables slower than built in?

2019-05-23 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Thursday, 23 May 2019 at 21:30:47 UTC, Alex wrote: I don't see how that can necessarily be faster. A LUT can give full 64-bit precision with one operation. The CORDIC needs iteration, at least 10 to be of any use. LUT's are precision independent assuming the creation cost is not included.

Re: Performance of tables slower than built in?

2019-05-23 Thread Alex via Digitalmars-d-learn
On Thursday, 23 May 2019 at 18:57:03 UTC, Ola Fosheim Grøstad 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 slower than the function itself?!? Not when

Re: Performance of tables slower than built in?

2019-05-23 Thread Alex via Digitalmars-d-learn
On Thursday, 23 May 2019 at 19:17:40 UTC, Ola Fosheim Grøstad wrote: On Wednesday, 22 May 2019 at 00:22:09 UTC, JS wrote: xxx = 0; sw.reset(); sw.start(); for(double i = 0; i < 1000; i++) xxx += sin(PI*i); t = sw.peek().msecs; writeln(t);

Re: Why GNU coreutils/dd is creating a dummy file more efficiently than D's For loop?

2019-05-23 Thread Daniel Kozák via Digitalmars-d-learn
On Thursday, 23 May 2019 at 18:37:17 UTC, H. S. Teoh wrote: On Thu, May 23, 2019 at 06:20:23PM +, kdevel via Digitalmars-d-learn wrote: On Thursday, 23 May 2019 at 09:44:15 UTC, Cym13 wrote: [...] > To go fast, read/write bigger chunks. Or use rawWrite instead of write (reduces the

Re: Why GNU coreutils/dd is creating a dummy file more efficiently than D's For loop?

2019-05-23 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, May 23, 2019 at 11:06 PM Daniel Kozak wrote: > On Thu, May 23, 2019 at 11:10 AM BoQsc via Digitalmars-d-learn < > digitalmars-d-learn@puremagic.com> wrote: > > https://matthias-endler.de/2017/yes/ > So this should do it void main() { import std.range : array, cycle, take;

Re: Why GNU coreutils/dd is creating a dummy file more efficiently than D's For loop?

2019-05-23 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, May 23, 2019 at 11:19 PM Daniel Kozak wrote: Fixed version without decode to dchar void main() { import std.range : array, cycle, take; import std.stdio; import std.utf; immutable buf_size = 8192; immutable buf = "\x00".byCodeUnit.cycle.take(buf_size).array; auto

Re: Why GNU coreutils/dd is creating a dummy file more efficiently than D's For loop?

2019-05-23 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, May 23, 2019 at 11:10 AM BoQsc via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > This code of D creates a dummy 47,6 MB text file filled with Nul > characters in about 9 seconds > > import std.stdio, std.process; > > void main() { > > writeln("Creating a dummy

Re: Performance of tables slower than built in?

2019-05-23 Thread Alex via Digitalmars-d-learn
On Thursday, 23 May 2019 at 15:20:22 UTC, Timon Gehr wrote: On 23.05.19 12:21, Alex wrote: On Wednesday, 22 May 2019 at 00:55:37 UTC, Adam D. Ruppe 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

Re: Performance of tables slower than built in?

2019-05-23 Thread Ola Fosheim Grøstad 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?!? Not when I tried it with one of the online compilers, LUT is 3-4 times faster

Re: Why GNU coreutils/dd is creating a dummy file more efficiently than D's For loop?

2019-05-23 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, May 23, 2019 at 06:20:23PM +, kdevel via Digitalmars-d-learn wrote: > On Thursday, 23 May 2019 at 09:44:15 UTC, Cym13 wrote: [...] > > To go fast, read/write bigger chunks. > > Or use rawWrite instead of write (reduces the runtime to about 1.6 s). > When using write time is IMHO spent

Re: Why GNU coreutils/dd is creating a dummy file more efficiently than D's For loop?

2019-05-23 Thread kdevel via Digitalmars-d-learn
On Thursday, 23 May 2019 at 09:44:15 UTC, Cym13 wrote: [...] Note in particular the blocksize argument. I set it to 1M but by default it's 512 bytes. If you use strace with the command above you'll see a series of write() calls, each writting 1M of null bytes to testfile. That's the main

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

2019-05-23 Thread Eugene Wissner via Digitalmars-d-learn
On Thursday, 23 May 2019 at 14:50:12 UTC, Per Nordlöw wrote: How do I specify a druntime flag such as --DRT-gcopt=gc:precise when running with dub as dub run --compiler=dmd --build=unittest ? The precise GC flag was introduced in verison 2.085.0 See: -

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

2019-05-23 Thread Per Nordlöw via Digitalmars-d-learn
On Thursday, 23 May 2019 at 15:05:15 UTC, rikki cattermole wrote: Should be as easy as     dflags "--DRT-gcopt=gc:precise" right? That would be passed to dmd, not to the build executable upon running. You mean wise versa, right? Now I understand, --DRT-gcopt=gc:precise is passed to

Re: Performance of tables slower than built in?

2019-05-23 Thread Timon Gehr via Digitalmars-d-learn
On 23.05.19 12:21, Alex wrote: On Wednesday, 22 May 2019 at 00:55:37 UTC, Adam D. Ruppe 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 slower than the

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

2019-05-23 Thread rikki cattermole via Digitalmars-d-learn
On 24/05/2019 3:03 AM, Per Nordlöw wrote: On Thursday, 23 May 2019 at 15:02:12 UTC, rikki cattermole wrote: And if I want to set this in a dub.sdl? No can do. There is meant to be a way to set it in D however. But I have heard mixed results (not that I've tried it). Should be as easy as   

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

2019-05-23 Thread rikki cattermole via Digitalmars-d-learn
On 24/05/2019 2:58 AM, Per Nordlöw wrote: On Thursday, 23 May 2019 at 14:51:41 UTC, rikki cattermole wrote: dub run --compiler=dmd --build=unittest -- --DRT-gcopt=gc:precise Thanks! And if I want to set this in a dub.sdl? No can do. There is meant to be a way to set it in D however. But I

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

2019-05-23 Thread Per Nordlöw via Digitalmars-d-learn
On Thursday, 23 May 2019 at 15:02:12 UTC, rikki cattermole wrote: And if I want to set this in a dub.sdl? No can do. There is meant to be a way to set it in D however. But I have heard mixed results (not that I've tried it). Should be as easy as dflags "--DRT-gcopt=gc:precise" right?

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

2019-05-23 Thread rikki cattermole via Digitalmars-d-learn
On 24/05/2019 3:01 AM, Per Nordlöw wrote: On Thursday, 23 May 2019 at 14:51:41 UTC, rikki cattermole wrote: dub run --compiler=dmd --build=unittest -- --DRT-gcopt=gc:precise Hmm, the flag doesn't propagate to dmd when compiling in verbose mode via -v as     dub run -v --compiler=dmd

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

2019-05-23 Thread Per Nordlöw via Digitalmars-d-learn
On Thursday, 23 May 2019 at 14:51:41 UTC, rikki cattermole wrote: dub run --compiler=dmd --build=unittest -- --DRT-gcopt=gc:precise Hmm, the flag doesn't propagate to dmd when compiling in verbose mode via -v as dub run -v --compiler=dmd --build=unittest -- --DRT-gcopt=gc:precise

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

2019-05-23 Thread Per Nordlöw via Digitalmars-d-learn
On Thursday, 23 May 2019 at 14:51:41 UTC, rikki cattermole wrote: dub run --compiler=dmd --build=unittest -- --DRT-gcopt=gc:precise Thanks! And if I want to set this in a dub.sdl?

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

2019-05-23 Thread Per Nordlöw via Digitalmars-d-learn
How do I specify a druntime flag such as --DRT-gcopt=gc:precise when running with dub as dub run --compiler=dmd --build=unittest ? The precise GC flag was introduced in verison 2.085.0 See: - https://dlang.org/changelog/2.085.0.html#gc_precise -

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

2019-05-23 Thread rikki cattermole via Digitalmars-d-learn
On 24/05/2019 2:50 AM, Per Nordlöw wrote: How do I specify a druntime flag such as     --DRT-gcopt=gc:precise when running with dub as     dub run --compiler=dmd --build=unittest dub run --compiler=dmd --build=unittest -- --DRT-gcopt=gc:precise

Re: Performance of tables slower than built in?

2019-05-23 Thread Alex via Digitalmars-d-learn
On Wednesday, 22 May 2019 at 00:55:37 UTC, Adam D. Ruppe 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 slower than the function itself?!? There's

Re: Performance of tables slower than built in?

2019-05-23 Thread Alex via Digitalmars-d-learn
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 slower than the function itself?!? [...] Hi,

Linking a .h file

2019-05-23 Thread infinityplusb via Digitalmars-d-learn
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 running on Ubuntu. I'm using dub and

Re: Why function does not work with delegate

2019-05-23 Thread Alex via Digitalmars-d-learn
On Wednesday, 22 May 2019 at 23:54:47 UTC, Adam D. Ruppe wrote: On Wednesday, 22 May 2019 at 22:33:52 UTC, Alex wrote: auto x = (GdkEventButton* e, Widget w) ... X.addOnButtonPress(x); Why is x not a delegate? Because you didn't ask for one and it didn't have to be. Just add the

Re: Why GNU coreutils/dd is creating a dummy file more efficiently than D's For loop?

2019-05-23 Thread Cym13 via Digitalmars-d-learn
On Thursday, 23 May 2019 at 09:09:05 UTC, BoQsc wrote: This code of D creates a dummy 47,6 MB text file filled with Nul characters in about 9 seconds import std.stdio, std.process; void main() { writeln("Creating a dummy file"); File file = File("test.txt", "w"); for (int

Why GNU coreutils/dd is creating a dummy file more efficiently than D's For loop?

2019-05-23 Thread BoQsc via Digitalmars-d-learn
This code of D creates a dummy 47,6 MB text file filled with Nul characters in about 9 seconds import std.stdio, std.process; void main() { writeln("Creating a dummy file"); File file = File("test.txt", "w"); for (int i = 0; i < 5000; i++) {

Re: Meson build system user learning D.

2019-05-23 Thread Russel Winder via Digitalmars-d-learn
On Thu, 2019-05-23 at 04:21 +, Mike Brockus via Digitalmars-d-learn wrote: > […] > > That is cool that Atila was kind enough to accept the meson.build > file. But how do I use the written meson.build that is > apparently in the subdirectory directory "build"? Just asking > because