1. Jiri's text.e
I saw stated that you generally poke and entire sequence instead of
one byte at a time because it is generally faster. Well I don't disagree
with the speed of pokeing entire sequences. I do however feel that
in the case of BUILDING the color coded sequence to be poked
you lose some speed. It is suprisingly faster to poke a character
then poke its color than it is to build the sequence of character
and its color and then poke the sequence.
Of course you may now some sequence magic that I haven't
come across as of yet. I believe in my attempt I used.
function build_string(sequence text, integer color)
integer l, inc
integer color-- assume this contains both foreground & background.
sequence s
l = length(s) * 2
s = repeat(color, l)
inc = 1
for A = 1 to l by 2 do
s[A] = text[inc]
inc = inc + 1
end for
return s
end function
I also notice that your fill_block could be optimized.
First you must build and keep a pattern for faster
building of the sequence.
sequence pattern
pattern = repeat(0, 4000)--max screen size
for A = 2 to 4000 by 2 do
pattern[A] = 1
end for
global procedure fill_block(integer row,integer column,integer width,
integer height, integer char)
-- fill given block using character char and current color attributes
sequence s
integer a,w
w=2*width
s=repeat(char,w)
-- for i=2 to w by 2 do s[i]=ca end for -- Your code
s = s + pattern[1..w] * ca -- My code
a=so+2*(row-1)*nc+2*(column-1) -- top left corner
w=2*nc
for h=1 to height do
poke(a,s)
a=a+w
end for
end procedure
_________________________
Lucius L. Hilley III lhilley at cdc.net
http://www.cdc.net/~lhilley
http://www.americanantiques.com
http://www.dragonvet.com
_________________________
2. Re: Jiri's text.e
Dear Lucius,
Are you trying to rewrite the recent history?
Allow me to refresh your memory. On 23 Nov 1998, subject Fastest Print
to Screen, you recommended Hilley's Utilities: llh-e.zip.
A couple of days later, when one of your unfortunate customers moaned
about the hilarious lack of color, you produced another, this time
colorized version.
I tested your fast_puts against the normal puts and my write. I used
10,000 screen writes of the standard string s = "Lucius Hilley III",
on a P II, 266 MHz machine, under NT 4.00:
puts: 1.41 s
Hilley's fast_puts: 0.94 s
my write: 0.27 s
In your last note on the subject you kindly introduced me, with
considerable hindsight and a perfectly straight face to your latest
creation, your build_string function. Surely you must know by now that
is essentially the method I used in my write...
And as to your 'optimization' advice, I hope you have already checked
it and you are not really serious. jiri
3. Re: Jiri's text.e
Hey someone told me to go to pete's site to get a program that will convert
ASM to that code you can use in Euphoria. What is the URL?
Albert