1. put.e update
- Posted by Lucius L Hilley III <luciuslhilleyiii at JUNO.COM> Aug 01, 1997
- 622 views
I have discovered OR rediscovered some faster coding techniques since I have been using Euphoria. I decided to use my OLD put.e and found that it didn't out perform the normal Euphoria puts() command. At first I thought that Euphoria was just so much faster now. I am sure that it is BUT then I looked at the code and noticed that I had used some novice techniques that I have since abandoned. I have refurbish put.e and it now performs 2 times as fast as it did. it is roughly 2 times as fast as Euphoria's usual puts() command. The code follows signature: --Lucius Lamar Hilley III -- E-mail at luciuslhilleyiii at juno.com -- I support transferring of files less than 60K. -- I can Decode both UU and Base64 format. ------------------------------------------------------------- --fast_puts-- This procedure is safe. It uses no color unless you exceed --boundary, if you exceed boundary then it automaticaly reverts to puts --instead of poking. This keeps the output SAFE. ------------------------------------------------------------- global procedure fast_puts(sequence s) atom p integer l, width sequence w, vc vc = machine_func(13, 0) w = machine_func(25, 0) - 1 width = vc[4] + vc[4] p = w[1] * width + w[2] + w[2] l = length(s) if vc[2] < 4 and vc[3] * width > l + l + p then p = #B8000 + p for A = 1 to l do poke(p, s[A]) p = p + 2 end for else puts(1, s) w = w + 1 position(w[1], w[2]) end if end procedure --f_puts(integer, sequence) --WARNING. this is a FAST, NOT SAFE, procedure. -- . if sequence goes out of bounds it -- . may cause serious damage. -- USE AT OWN RISK. --sequence is what to print --integer is 1 for 80 column OR --integer is (not 1) for 40 column ------------------------------------------------------------- global procedure f_puts(integer v, sequence s) atom p sequence w w = machine_func(25, 0) - 1 if v = 1 then v = 160 -- this is default 80 column video else v = 80 -- this is 40 column video end if p = #B8000 + w[1] * v + w[2] + w[2] for A = 1 to length(s) do poke(p, s[A]) p = p + 2 end for end procedure