1. RE: assembly
- Posted by Brian Broker <bkb at cnw.com> Oct 08, 2001
- 383 views
Evan, Are you sure you need assembly? Perhaps if you share your bit of code you might be suprised at what optimizations could be made just using Euphoria sequence operations... -- Brian > I have a bit of code that would be sped up immensely with a bit of > assembly. The problem is that I haven't done any assembly programming > since the late-mid '80's. Does any one know where I can find a simple > tutorial on assembly and/or a list of opcodes in hex (or binary). > Specifically, I need to load a sequence into memory, check each > element, and return a result depending on the status of the element. > The sequence is in the form of > {{{x1,y1},a1}},{{x2,y2},a2},...{{xn,yn},an}} > >
3. Re: RE: assembly
- Posted by Jiri Babor <jbabor at PARADISE.NET.NZ> Oct 08, 2001
- 384 views
-- decompose phl sequence - try something like this: a = repeat(0, 256) x1 = a x2 = a y1 = a y2 = a for b = 1 to 256 do a = phl[b][2] x1 = phl[b][1][1] - 2 x1 = phl[b][1][2] - 2 x1 = phl[b][1][1] + 1 x1 = phl[b][1][2] + 1 end for -- then one level indexing is MUCH faster: for b = 1 to 256 do if a[b] = i then ellipse(a[b], 1, {x1[b], y1[b]}, {x2[b], y2[b]}) end if end for -- jiri
5. Re: RE: assembly
- Posted by Jiri Babor <jbabor at PARADISE.NET.NZ> Oct 08, 2001
- 389 views
Sorry, I was in a bit of a rush... The second block should, obviously, read: for b = 1 to 256 do a[b] = phl[b][2] x1[b] = phl[b][1][1] - 2 y1[b] = phl[b][1][2] - 2 x2[b] = phl[b][1][1] + 1 y2[b] = phl[b][1][2] + 1 end for I am of course assuming you can prepare your data ahead of time ;) jiri ----- Original Message ----- From: "Jiri Babor" <jbabor at PARADISE.NET.NZ> To: "EUforum" <EUforum at topica.com> Sent: Tuesday, 9 October 2001 09:18 Subject: Re: RE: assembly > > -- decompose phl sequence - try something like this: > > a = repeat(0, 256) > x1 = a > x2 = a > y1 = a > y2 = a > > for b = 1 to 256 do > a = phl[b][2] > x1 = phl[b][1][1] - 2 > x1 = phl[b][1][2] - 2 > x1 = phl[b][1][1] + 1 > x1 = phl[b][1][2] + 1 > end for > > > -- then one level indexing is MUCH faster: > > for b = 1 to 256 do > if a[b] = i then > ellipse(a[b], 1, {x1[b], y1[b]}, {x2[b], y2[b]}) > end if > end for > > -- jiri > > >
6. RE: assembly
- Posted by Derek Parnell <ddparnell at bigpond.com> Oct 08, 2001
- 379 views
----- Original Message ----- From: "Jiri Babor" <jbabor at PARADISE.NET.NZ> To: "EUforum" <EUforum at topica.com> Subject: Re: RE: assembly > -- decompose phl sequence - try something like this: > > a = repeat(0, 256) > x1 = a > x2 = a > y1 = a > y2 = a > > for b = 1 to 256 do > a = phl[b][2] > x1 = phl[b][1][1] - 2 > x1 = phl[b][1][2] - 2 > x1 = phl[b][1][1] + 1 > x1 = phl[b][1][2] + 1 > end for > > > -- then one level indexing is MUCH faster: > > for b = 1 to 256 do > if a[b] = i then > ellipse(a[b], 1, {x1[b], y1[b]}, {x2[b], y2[b]}) > end if > end for > Another optimisation could be to eliminate the sequence forming in the ellipse call at run time. a = repeat(0, 256) xy1 = repeat({0,0}, 256) xy2 = repeat({0,0}, 256) for b = 1 to 256 do a[b] = phl[b][2] xy1[b][1] = phl[b][1][1] - 2 xy1[b][2] = phl[b][1][2] - 2 xy2[b][1] = phl[b][1][1] + 1 xy2[b][2] = phl[b][1][2] + 1 end for -- then one level indexing is MUCH faster: for b = 1 to 256 do if a[b] = i then ellipse(a[b], 1, xy1[b], xy2[b]) end if end for ----------- But back to the original question. To do this using assembly code would require that you know the internal layout of sequences and that is not published and may change from release to release. Instead you would have to store the coordinates in RAM arrays rather than sequences. --------- Derek
7. Re: RE: assembly
- Posted by Derek Parnell <ddparnell at bigpond.com> Oct 08, 2001
- 374 views
Just thought of something else. If you can sort the sequences you might be able to do a binary search rather than a sequential search. ----- Original Message ----- From: "Evan Marshall" <evan at net-link.net> To: "EUforum" <EUforum at topica.com> Subject: Re: RE: assembly sequence phl phl = {{{x1,y1},a1},{{x2,y2},a2},...{{xn,yn},an}} for b = 1 to 256 do c = phl[b][1][1] d = phl[b][1][2] if phl[b][2] = i then ellipse(phl[b][2],1,{c-2,d-2},{c+1,d+1}) end if end for P.S. I had to create variables c and d because when I had the element directly in the ellipse function, the first y value never changed (!?). i.e. {1,2},{4,2}..{10,2},{14,2} Brian Broker <bkb at cnw.com> wrote: > > Evan, > > Are you sure you need assembly? Perhaps if you share your bit of code > you might be suprised at what optimizations could be made just using > Euphoria sequence operations... > > -- Brian > > > I have a bit of code that would be sped up immensely with a bit of > > assembly. The problem is that I haven't done any assembly programming > > since the late-mid '80's. Does any one know where I can find a simple > > tutorial on assembly and/or a list of opcodes in hex (or binary). > > Specifically, I need to load a sequence into memory, check each > > element, and return a result depending on the status of the element. > > The sequence is in the form of > > {{{x1,y1},a1}},{{x2,y2},a2},...{{xn,yn},an}} > > > >
8. Re: RE: assembly
- Posted by euman at bellsouth.net Oct 08, 2001
- 379 views
From: "Derek Parnell" <ddparnell at bigpond.com> > Just thought of something else. If you can sort the sequences you might be > able to do a binary search rather than a sequential search. > especially if you know the min - max values, this would/could be used to speed the process. Euman euman at bellsouth.net