Re: Speed of horizontal flip

2015-04-05 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 1 April 2015 at 13:52:06 UTC, tchaloupka wrote: C#: PNG load - 90ms PNG flip - 10ms PNG save - 380ms D using dlib (http://code.dlang.org/packages/dlib): PNG load - 500ms PNG flip - 30ms PNG save - 950ms D using imageformats (http://code.dlang.org/packages/imageformats): PNG load

Re: Speed of horizontal flip

2015-04-02 Thread Rikki Cattermole via Digitalmars-d-learn
On 2/04/2015 2:52 a.m., tchaloupka wrote: Hi, I have a bunch of square r16 and png images which I need to flip horizontally. My flip method looks like this: void hFlip(T)(T[] data, int w) { import std.datetime : StopWatch; StopWatch sw; sw.start(); foreach(int i; 0..w) {

Re: Speed of horizontal flip

2015-04-02 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Wednesday, 1 April 2015 at 14:00:52 UTC, bearophile wrote: If you have to perform performance benchmarks then use ldc or gdc. Also disable bound tests with your compilation switches. Add the usual pure/nothrow/@nogc/@safe annotations where you can (they don't increase speed much,

Re: Speed of horizontal flip

2015-04-02 Thread Rikki Cattermole via Digitalmars-d-learn
On 3/04/2015 4:27 a.m., John Colvin wrote: On Thursday, 2 April 2015 at 11:49:44 UTC, Rikki Cattermole wrote: On 3/04/2015 12:29 a.m., John Colvin wrote: On Thursday, 2 April 2015 at 09:55:15 UTC, Rikki Cattermole wrote: On 2/04/2015 10:47 p.m., Rikki Cattermole wrote: On 2/04/2015 2:52

Re: Speed of horizontal flip

2015-04-02 Thread John Colvin via Digitalmars-d-learn
On Thursday, 2 April 2015 at 09:55:15 UTC, Rikki Cattermole wrote: On 2/04/2015 10:47 p.m., Rikki Cattermole wrote: On 2/04/2015 2:52 a.m., tchaloupka wrote: Hi, I have a bunch of square r16 and png images which I need to flip horizontally. My flip method looks like this: void hFlip(T)(T[]

Re: Speed of horizontal flip

2015-04-02 Thread Rikki Cattermole via Digitalmars-d-learn
On 3/04/2015 12:29 a.m., John Colvin wrote: On Thursday, 2 April 2015 at 09:55:15 UTC, Rikki Cattermole wrote: On 2/04/2015 10:47 p.m., Rikki Cattermole wrote: On 2/04/2015 2:52 a.m., tchaloupka wrote: Hi, I have a bunch of square r16 and png images which I need to flip horizontally. My flip

Re: Speed of horizontal flip

2015-04-02 Thread Rikki Cattermole via Digitalmars-d-learn
On 2/04/2015 10:47 p.m., Rikki Cattermole wrote: On 2/04/2015 2:52 a.m., tchaloupka wrote: Hi, I have a bunch of square r16 and png images which I need to flip horizontally. My flip method looks like this: void hFlip(T)(T[] data, int w) { import std.datetime : StopWatch; StopWatch sw;

Re: Speed of horizontal flip

2015-04-02 Thread John Colvin via Digitalmars-d-learn
On Thursday, 2 April 2015 at 05:21:08 UTC, thedeemon wrote: std.algorithm.reverse uses ranges, and shamefully DMD is really bad at optimizing away range-induced costs. The specialisation of reverse selected for slices does not use the range interface, it's all just indexing. The only

Re: Speed of horizontal flip

2015-04-02 Thread John Colvin via Digitalmars-d-learn
On Thursday, 2 April 2015 at 11:49:44 UTC, Rikki Cattermole wrote: On 3/04/2015 12:29 a.m., John Colvin wrote: On Thursday, 2 April 2015 at 09:55:15 UTC, Rikki Cattermole wrote: On 2/04/2015 10:47 p.m., Rikki Cattermole wrote: On 2/04/2015 2:52 a.m., tchaloupka wrote: Hi, I have a bunch of

Re: Speed of horizontal flip

2015-04-01 Thread bearophile via Digitalmars-d-learn
tchaloupka: Am I doing something utterly wrong? If you have to perform performance benchmarks then use ldc or gdc. Also disable bound tests with your compilation switches. Sometimes reverse() is not efficient, I think, it should be improved. Try to replace it with a little function written

Re: Speed of horizontal flip

2015-04-01 Thread tchaloupka via Digitalmars-d-learn
On Wednesday, 1 April 2015 at 14:00:52 UTC, bearophile wrote: tchaloupka: Am I doing something utterly wrong? If you have to perform performance benchmarks then use ldc or gdc. I tried it on my slower linux box (i5-2500K vs i7-2600K) without change with these results: C# (mono with

Re: Speed of horizontal flip

2015-04-01 Thread tchaloupka via Digitalmars-d-learn
On Wednesday, 1 April 2015 at 16:08:14 UTC, John Colvin wrote: On Wednesday, 1 April 2015 at 13:52:06 UTC, tchaloupka wrote: snip I'm pretty sure that the flipping happens in GDI+ as well. You might be writing C#, but the code your calling that's doing all the work is C and/or C++, quite

Re: Speed of horizontal flip

2015-04-01 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 1 April 2015 at 13:52:06 UTC, tchaloupka wrote: snip I'm pretty sure that the flipping happens in GDI+ as well. You might be writing C#, but the code your calling that's doing all the work is C and/or C++, quite possibly carefully optimised over many years by microsoft. Are

Re: Speed of horizontal flip

2015-04-01 Thread thedeemon via Digitalmars-d-learn
std.algorithm.reverse uses ranges, and shamefully DMD is really bad at optimizing away range-induced costs.