There are a number of ways that you can optimize the Factor code
before resorting to unportable assembly language. For one, making all
combinators inline allows the compiler to perform defunctionalization,
removing all extra overhead associated with higher-order functions.
Other well-placed inline declarations would allow the compiler to
perform stronger optimizations. You can also experiment with hints to
instruct the compiler to make specialized versions of words for
certain types of inputs. The Factor implementation frequently becomes
faster, so using the a recent version will also help performance.

Dan

On Wed, May 6, 2009 at 10:12 PM, Hugh Aguilar <[email protected]> wrote:
> I have my symtab program ready for you guys to look at. I havn't got it onto
> github yet because my Linux system isn't working, so I just uploaded it to
> my website where you can grab it: http://www.rosycrew.com/symtab.factor
>
> This is a symbol table that uses an algorithm of my own invention. I
> originally wrote this in IBM370 assembly language about 10-13 years ago.
> There was no damping then. Later, I upgraded to ANS-Forth and added a small
> damping (value of 5) to reduce "churning" (described in the comments). Now I
> have upgraded to Factor. I added the ability to smudge (hide) words. I also
> have a prune function that deletes smudged nodes at the leaves. Having done
> this, I realized that I needed some way to optimize the tree, which would
> push all of the smudged nodes down to the leaves. I wrote the optimize
> function in the last few days to do this. Now that I have an optimize
> function, I have also raised my damping level to 30. The idea is that the
> user can have this high damping level during normal usage, but can also
> periodically run optimize (at the end of every work session would be a good
> time). Alternatively, you can set the damping level at 0, in which case you
> don't need to run optimize at all; the tree is continually maintained in an
> optimized state (except for the smudged nodes that take some time to work
> their way down to the leaves).
>
> The previous paragraph will make a lot more sense after you have studied the
> source file. It is pretty short, with only a handful of functions, so you
> should be able to figure it out quickly. It is not too complicated, and it
> is heavily documented; if you do have trouble though, let me know and I will
> answer your questions. I am likely not using very idiomatic Factor, as this
> is my first effort at Factor programming. I'm still mentally translating
> everything from ANS-Forth. I definitely want to hear your criticisms in this
> regard to help me learn more idiomatic Factor. I am also interested in any
> criticism you may have of my algorithm. I don't know of anybody who has ever
> done a symbol table in this manner before; I think my algorithm is original.
>
> The program is recursive and would benefit a lot from being rewritten in
> assembly language. The functions that insert nodes and find nodes are both
> short, and would be the most likely candidates for assembly language. If
> there is any interest, I will do this. I read somewhere that Factor has a
> Pentium assembler available, but I haven't examined it yet. That is my next
> project.
>
> Is it true that Factor internally uses a hash table resolved with linked
> lists? In my comments in the source file I compare my algorithm to hash
> tables and explain why I think that my algorithm is better.
>
>
> ------------------------------------------------------------------------------
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
> Series Scanner you'll get full speed at 300 dpi even with all image
> processing features enabled. http://p.sf.net/sfu/kodak-com
> _______________________________________________
> Factor-talk mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to