Post Reply 
Complex Plotting App
02-18-2015, 04:41 PM (This post was last modified: 02-18-2015 05:06 PM by Han.)
Post: #28
RE: Complex Plotting App
Some minor suggestions that may (or may not) give a tiny bit of speed boost:

1. Originally, my first code submission contained a bug that would compute the z-value for the bottom left corner of the screen, but color the top left. That has since been fixed. I think that it's faster to use:

a:=x*2*d; b:=y*2*d+d;
z1:=Xmin+a*dx+i*(Ymax-b*dy);

instead of

a:=x*2*d; b:=y*2*d; b1:=(120/d-1-y)*2*d+d;
z1:=Xmin+a*dx+i*(Ymin+b1*dy);

since there are fewer floating point operations in the former vs. the latter.

2. In the case where k=r (i.e. when d=1), you can save a few more flops by changing

FOR x FROM 0 TO 160/d-1 DO
FOR y FROM 0 TO 120/d-1 DO
a:=x*2*d; b:=y*2*d;

to

FOR x FROM 0 TO 159 DO
FOR y FROM 0 TO 119 DO
a:=x*2; b:=y*2;

and subsequent references to d should be removed (so that fewer flops are used).

3. Rather than subtracting LN(c), create a constant lnc:=LN(c); and replace

k:=(m/(c*e^FLOOR(LN(m)-LN(c)))-1)*em1;

with

k:=(m/(c*e^FLOOR(LN(m)-lnc))-1)*em1;

since this means one fewer operation (computing LN(c) costs more than simply subtracting the pre-computed value)

4. (EDIT): move the definition of a in a:=x*2*d; to _outside_ the FOR y loop (since a doesn't needed to be recomputed every time we loop over y). This idea also suggests that we should find a different way to compute z1 as we loop over x and y to further reduce the number of flops.


These are minor changes, but since we're looping 76800 times, it may be that they add up to slight speedups.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Complex Plotting App - danielmewes - 12-30-2014, 09:17 AM
RE: Complex Plotting App - dwgg - 02-01-2015, 01:06 AM
RE: Complex Plotting App - Han - 02-01-2015, 04:01 AM
RE: Complex Plotting App - dwgg - 02-01-2015, 06:42 AM
RE: Complex Plotting App - Mark Hardman - 02-01-2015, 11:17 PM
RE: Complex Plotting App - dwgg - 02-02-2015, 03:43 PM
RE: Complex Plotting App - rprosperi - 02-02-2015, 04:54 PM
RE: Complex Plotting App - dwgg - 02-03-2015, 06:56 PM
RE: Complex Plotting App - danielmewes - 02-04-2015, 03:39 AM
RE: Complex Plotting App - dwgg - 02-06-2015, 04:21 AM
RE: Complex Plotting App - Han - 02-06-2015, 08:17 PM
RE: Complex Plotting App - Han - 02-07-2015, 06:02 AM
RE: Complex Plotting App - rprosperi - 02-07-2015, 03:38 PM
RE: Complex Plotting App - Han - 02-07-2015, 06:24 PM
RE: Complex Plotting App - rprosperi - 02-08-2015, 04:06 PM
RE: Complex Plotting App - Eddie W. Shore - 02-12-2015, 03:26 AM
RE: Complex Plotting App - rprosperi - 02-12-2015, 04:02 AM
RE: Complex Plotting App - Eddie W. Shore - 04-02-2015, 02:58 AM
RE: Complex Plotting App - Han - 04-02-2015, 12:10 PM
RE: Complex Plotting App - salvomic - 04-02-2015, 02:48 PM
RE: Complex Plotting App - Eddie W. Shore - 04-04-2015, 03:03 PM
RE: Complex Plotting App - dwgg - 02-12-2015, 06:29 AM
RE: Complex Plotting App - Han - 02-12-2015, 08:23 AM
RE: Complex Plotting App - dwgg - 02-13-2015, 02:52 AM
RE: Complex Plotting App - Han - 02-13-2015, 10:04 PM
RE: Complex Plotting App - dwgg - 02-14-2015, 12:01 AM
RE: Complex Plotting App - dwgg - 02-14-2015, 11:43 AM
RE: Complex Plotting App - salvomic - 04-02-2015, 05:17 PM
RE: Complex Plotting App - Han - 04-02-2015, 05:40 PM
RE: Complex Plotting App - salvomic - 04-02-2015, 05:50 PM
RE: Complex Plotting App - Han - 02-14-2015, 07:14 PM
RE: Complex Plotting App - dwgg - 02-14-2015, 10:18 PM
RE: Complex Plotting App - Han - 02-17-2015, 01:34 AM
RE: Complex Plotting App - dwgg - 02-18-2015, 06:35 AM
RE: Complex Plotting App - Han - 02-18-2015 04:41 PM
RE: Complex Plotting App - Han - 02-18-2015, 10:08 PM
RE: Complex Plotting App - dwgg - 02-19-2015, 02:06 AM
RE: Complex Plotting App - Han - 02-19-2015, 02:14 AM
RE: Complex Plotting App - Han - 03-17-2017, 07:28 PM
RE: Complex Plotting App - jtm - 06-30-2017, 03:48 AM
RE: Complex Plotting App - Han - 07-01-2017, 12:17 AM
RE: Complex Plotting App - FrankP - 12-25-2019, 12:26 PM



User(s) browsing this thread: 1 Guest(s)