Forth Vs Clean Vs J vs Lisp

  • Permalink
  • submit to reddit
  • Email
  • Follow


Dear Friends of Forth,
I have just found Forth and am excited about it. But i need to clarify
its benefits in  pc programming rather than using c, c++ or Java or a
scripting language. Then there is speed of execution. Seems Forth is
like Lisp in that it can be used to write or extend one's own language
because you can build up your own definitions. Lisp is powerful and
expressive and fast prototyping like Forth but usually slow. Forth can
go down further to lower level programming - powerful. But is the speed
one gets without heavy tweaking better than most other languages?
Interpreted Forth competes with compiled other langs or compiled Forth
is competes with c or c++?? Is the time taken to learn Forth going to
get me fast programs??? Faster than J( the apl functional non Von
Neumann  language) or Clean the purely   functional lang with graph
rewriting??
Sorry i don't understand better (yet?). I think because Forth has
assembly  code connections and possibly machine code bit patterns in
memory it wil be very fast executingh . Well worth the time spent
besides the mind expanding nature of Forth 'philosophy' and
programming.
I know shootouts are misleading but in
http://shootout.alioth.debian.org/  Forth was behind Clean and Ocaml an
others. but was this compiled or interpreted Forth??
http://shootout.alioth.debian.org/gp4sandbox/benchmark.php?test=all&lang=bigforth&lang2=bigforth
has specs on Bigforth.
Hope you can help my confusion by giving an idea of where Forth sit in
comparison to other languages in terms of execution speed. Of course
comments on other joys and benefits of the language are welcome. Thanks

0
Reply peggymark (11) 10/30/2006 8:32:13 AM

See related articles to this posting

On 30 Oct 2006 00:32:13 -0800, peggymark@sriaurobindoashram.com wrote:

>Hope you can help my confusion by giving an idea of where Forth sit in
>comparison to other languages in terms of execution speed.

The range of execution speeds is about 12:1 for current Forths. The
best compete very well with C.

The commercial Forths are the fast ones. Download the free evaluation
version of VFX Forth for Windows from
  http://www.mpeforth.com
and look at the benchmark code. See also Forth Inc's SwiftForth.

Stephen


-- 
Stephen Pelc, stephenXXX@mpeforth.com
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691
web: http://www.mpeforth.com - free VFX Forth downloads
0
Reply stephenXXX (1303) 10/30/2006 12:00:09 PM

peggymark@sriaurobindoashram.com wrote:

> Dear Friends of Forth,
> I have just found Forth and am excited about it. But i need to clarify
> its benefits in  pc programming rather than using c, c++ or Java or a
> scripting language. Then there is speed of execution. Seems Forth is
> like Lisp in that it can be used to write or extend one's own language
> because you can build up your own definitions. Lisp is powerful and
> expressive and fast prototyping like Forth but usually slow.

At least for some modern implementation, that's not true for Lisp, either -
see the shootout. If you weight CPU time, memory use and source size equal,
bigFORTH is now at rank 4 (with one missing item, which runs fine on my PC,
but doesn't run on the shootout sandbox, for yet unknown reasons). If you
drop memory use and source size, it falls behind several Lisp derivatives;
it's about a factor 2 to gcc (which is number one), while OCaml is about a
factor 1.4. Note that the Pentium 4 is distorting the results a bit, I
don't optimize for the Netburst architecture, and never will (it's dead,
Jim ;-).

> Forth can 
> go down further to lower level programming - powerful. But is the speed
> one gets without heavy tweaking better than most other languages?

If you want speed, speed, and speed, you better stick with GCC. This
compiler has more tuning effort put into it than all the other competing
ones. It's not the language that makes it fast, it's the effort.

> Interpreted Forth competes with compiled other langs or compiled Forth
> is competes with c or c++?? Is the time taken to learn Forth going to
> get me fast programs??? Faster than J( the apl functional non Von
> Neumann  language) or Clean the purely   functional lang with graph
> rewriting??

Forth is not "interpreted" in the traditional sense. You have an
interpreter, and an incremental compiler, but the code you typically
execute is compiled. Sometimes to a virtual machine (i.e. with an
interpretation layer below), but nowadays more often to machine code.

> Sorry i don't understand better (yet?). I think because Forth has
> assembly  code connections and possibly machine code bit patterns in
> memory it wil be very fast executingh . Well worth the time spent
> besides the mind expanding nature of Forth 'philosophy' and
> programming.
> I know shootouts are misleading but in
> http://shootout.alioth.debian.org/  Forth was behind Clean and Ocaml an
> others. but was this compiled or interpreted Forth??

Compiled. However, it's different: Gforth is a VM-based Forth; it does
compile to machine code, but only by copying the primitives (no
optimization). bigFORTH has rule-based optimization. VFX or iForth have
analytic optimizations and are typically about twice as fast as bigFORTH,
except where the analytics of these systems is outwitted by clever rules
(main point: global register allocation ;-).

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://www.jwdt.com/~paysan/
0
Reply bernd.paysan (2418) 10/30/2006 2:07:19 PM

peggymark@sriaurobindoashram.com writes Re: Forth Vs Clean Vs J vs Lisp

>                     Then there is speed of execution. Seems Forth is
> like Lisp in that it can be used to write or extend one's own language
> because you can build up your own definitions. Lisp is powerful and
> expressive and fast prototyping like Forth but usually slow. Forth can
> go down further to lower level programming - powerful. But is the speed
> one gets without heavy tweaking better than most other languages?

As Stephen said: the speedrange for current Forths is at least 1:12.
So, much will depend on the compiler you choose (or can afford).

With my current Forth there's no need to do heavy tweaking anymore. However, 
in Forth datastructures and algorithms are so ridiculously simple to define, 
test, and evaluate for efficiency that it is difficult to resist *not* 
to optimize them. With some care, each project you do will add a number 
of useful and re-usable "words" to your toolchest (so that you have
more time left over for the interesting bits of your problem).

> Interpreted Forth competes with compiled other langs or compiled Forth
> is competes with c or c++?? Is the time taken to learn Forth going to
> get me fast programs??? Faster than J( the apl functional non Von
> Neumann  language) or Clean the purely   functional lang with graph
> rewriting??

Well, C can be from two to four times faster than Forth sometimes 
(pfannkuch was my latest experience). But in this year's ICFP I wrote
the required virtual register machine in just a few hours, so I had 
more time to solve the puzzles (I ranked place 199 out of 361 - I hate
puzzles and dungeon-type adventures). BTW, my VM was only twice slower 
than the best published.

Comparing with J and Clean would be dangerous. These languages 
have some very powerful built-in primitives that can do specific tasks 
very efficiently. I played a bit with J, and the environment is marvelous 
(OpenGL 3D rendering with just a button press, yummy).

> I know shootouts are misleading but in
> http://shootout.alioth.debian.org/  Forth was behind Clean and Ocaml an
> others. but was this compiled or interpreted Forth??
> http://shootout.alioth.debian.org/gp4sandbox/benchmark.php?test=all&lang=bigforth&lang2=bigforth
> has specs on Bigforth.

Here you have to be especially careful :-) There are some languages that
'remember' the arguments with which functions are called and cache results.
Of course memoization is useful for some tasks, but standard Forth
applications (memory constrained) generally have no use for it.
Other languages are designed so that it is completely safe to evaluate a 
function with constant arguments at compile-time (sometimes they compile 
VERY slowly :-) It is not difficult to think of benchmarks where these
features would lead to spectacular benchmark results.

> Hope you can help my confusion by giving an idea of where Forth sit in
> comparison to other languages in terms of execution speed. Of course
> comments on other joys and benefits of the language are welcome. Thanks

Some experts (like Paul Hsieh) worry over icc being 10 - 20% faster than gcc. 
If you find that kind of difference mission critical, then Forth is not 
for you ...

-marcel

0
Reply mhx (2134) 10/30/2006 6:18:52 PM

Wow! You guys are great!! thanks for all the good feedback. SO nice to
get informed usable pertenant information sooo fast. There is so much
for me to learn and much sounds fun. I was asked to work on OpenBios so
i have a geat excuse to learn Forth. I am reading Brodie's books. I
have found HLA assembly language allowing higher level constructs on
top of assembly. SO i will try to learn assembly instructions and how
it works and then build my own words in Forth to write my a own
"functions" and build up from there. I think i have the usual newbie
fear that Assembly dwarecoding is too time consuming and tedious -
while forth can be fun yet still time consuming. And for both one needs
to know more technical lower level dynamics of computer hardware.
I am opting for the new paradigm and adventure.

Anyone wish to input on why they love Forth. Would be inspirational for
a kick start. What you can do with Forth you can't or wouldn't in other
languages, why its more fun in Forth and freeing etc.

Many thanks again for taking the time and care to help out one in
search.
Markandeya

0
Reply peggymark (11) 10/31/2006 7:10:38 AM
comp.lang.forth 5822 articles. 2 followers. Post

4 Replies
85 Views

Similar Articles

[PageSpeed] 32

  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

forth vs common lisp vs blah for website
will there ever be stuff like this for forth: http://restas.lisper.ru/en/overview.html#overview http://wuwei.name/ http://common-lisp.net/project/ucw/features.html http://web4r.org/en/ Now I know Charles Moore passed over lisp on his way to making FORTH. What would Charles, if he is listening, do to make website development easy? Would he avoid html? On 5/15/11 2:45 AM, gavino wrote: > will there ever be stuff like this for forth: > http://restas.lisper.ru/en/overview.html#overview > http://wuwei.name/ > http://common-lisp.net/project/ucw/features.html > http://web4r.org/en/...

forth vs lisp
anyone know both? which do you prefer? In article <fa7d1e92-d47e-4324-a17a-90490695efaf@v13g2000pro.googlegroups.com>, gavino <gavcomedy@gmail.com> wrote: > anyone know both? > > which do you prefer? Gavino has asked that question already fixnum+ times. ___________________________ /| /| | | ||__|| | Please don't | / O O\__ feed | / \ the trolls | / \ \ ...

forth vs lisp #2
opinions? On 8 Nov, 12:17, gavino <gavcom...@gmail.com> wrote: > opinions? they are simply best friends, jus' like you'n me. P.S. the only real difference is that Forth was inspired by the number 4, and Lisp by the number 7 (the number tells it all). gavino <gavcomedy@gmail.com> wrote: > opinions? My opinion is your a dumb motherfucker My opinion? Lisp is prefix FORTH. That hit me right off the bat when I started learning Lisp. Similar (for a beginner) experience of working with symbol table + interpreter. Prefix requires full parenthesisation, whereas pos...

forth vs common lisp
cl claims to be the most powerful programming language in the world!!! can forth outdo it? www.paulgraham.com On Apr 14, 8:05=A0pm, quiet_lad <gavcom...@gmail.com> wrote: > cl claims to be the most powerful programming language in the world!!! > can forth outdo it?www.paulgraham.com cl *itself* claims that? Why, sure, Forth can outdo that ... those, OTOH, most any language can: : .Forth-Claim ( -- ) CR ." I am more powerful than the most powerful " ." programming language in the world ! !! !!!" CR ; Outdoing *claims* is easy. Its backing them up...

forth abstraction vs lisp macroes
can forth build up abstractions such as lisp macroes can? are there some kind fo techniques ? ...

LISP vs HASKELL vs PROLOG
I'm not trying to start a flame war about which one is the best. Could anybody explain me each of these languages features and strong points ? !!!@!!! wrote: > I'm not trying to start a flame war about which one is the best. Could > anybody explain me each of these languages features and strong points ? I know a bit Common Lisp, but I'm still lisp toddler. I can barely understand haskell, and have troubles reading prolog code. So Common Lisp is multi-paradigm language - you can code in many different ways. Strong points are powerful macro system, continuous development ...

paul grahams arc, a new lisp, and his words about makign code shorter, vs forth?
http://paulgraham.com/arc0.html I know forth code is SHORT, and mr Graham is having arc 'mkae code shorter' The kind of dirtiness Arc seeks to avoid is verbose, repetitive source code. The way you avoid that is not by forbidding programmers to write it, but by making it easy to write code that's compact. One of the things I did while I was writing Arc was to comb through applications asking: what can I do to the language to make this shorter? Not in characters or lines of course, but in tokens. In a sense, Arc is an accumulation of years of tricks for making programs shorter. Sou...

WJ vs. Gavino... Factor vs. Forth
This is going to be the battle of the... I'm not sure what this is going to be. So far they have just circled each other with no contact. -- Rick On 4/13/13 11:20 AM, rickman wrote: > This is going to be the battle of the... I'm not sure what this is going > to be. So far they have just circled each other with no contact. > I wish the whole thing would just go away. It's not much of a spectator sport. Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. ...

J vs kx/Q vs APL
How would you guys compare J to kx/Q to APL? If one is to learn some, is it OK to start with Q or J (seems to have only ASCII characters), and then which -- Q or J? Are any of these compiled, and can you link some to OCaml compiled natively? Cheers, Alexy "braver" <deliverable@gmail.com> wrote in message news:2b75ebdd-09b3-4caa-87b2-f5a5d830c335@f40g2000pri.googlegroups.com... > How would you guys compare J to kx/Q to APL? If one is to learn some, > is it OK to start with Q or J (seems to have only ASCII characters), > and then which -- Q or J? Are ...