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 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 8 Guest(s)