Forth Vs Clean Vs J vs Lisp

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
peggymark (11)
10/30/2006 8:32:13 AM
comp.lang.forth 6340 articles. 0 followers. markrobertwills (871) is leader. Post Follow

4 Replies
441 Views

Similar Articles

[PageSpeed] 53
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
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
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
mhx (2135)
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
peggymark (11)
10/31/2006 7:10:38 AM
Reply:
Similar Artilces:

forth in forth
I came across this in the archives: >The widely shared belief (among both Forthies >and outsiders) that every "real" Forth programmer hacks together >his own compiler/interpreter/programming environment also makes >the Forth community look frivolous or at best naive. Most people >who program for a living know that there are more useful ways to >spend their time than building their own programming environment -- >the key to productivity is leveraging off other peoples' work. HERESY in the Forth community! Imagine... NOT coming up with your own CASE...

[ANN] Montreal Scheme/Lisp User Group meeting
We invite you to the first meeting of the Montreal Scheme/Lisp user group. *IMPORTANT* RSVP. We'd like to know how many people will come. And don't be shy ;-) We already expect 12-15 people, with lots of different backgrounds and interests. Date: Wednesday, May 19th. Location: DIRO, Universit� de Montr�al. Agenda: - General presentation - Marc Feeley will talk about the upcoming Gambit-C 4.0 (the new features, its implementation). For more information, visit our web site: http://www.iro.umontreal.ca/~boucherd/mslug/mslug-home-en.html The talk will be in english. Dominique ...

Black & white vs. grayscale settings (Epson 3170)
What's the diff between these two settings? I've been using grayscale so far, with good results. In article <20031021190210.00343.00001117@mb-m27.aol.com>, sb083459@aol.com says... > > >What's the diff between these two settings? I've been using grayscale so far, >with good results. Line art mode is often called B&W. It has no gray tones... only two colors, black or white, which is great for text, or drawings like cartoons. -- Wayne http://www.scantips.com "A few scanning tips" In article <20031021190210.00343.000...

8-bit Forth
I spent a few minutes looking at ByteForth, which appears to be a pretty complete 8-bit Forth: http://www.forthfreak.net/index.cgi?ByteForth I can't really tell too much specific about it since the documentation is written in Dutch. But, I get the impression that it really is 8-bit in the sense of having 8 bit data cells. And I'd think that means addresses don't fit in the cells. I'm basically wondering: 1) is that really waht it's doing? and 2) Did this method ever catch on in the 6502/8051/Z80 era? Or did the Forths on those systems all use 16-bit cells...

Encapsulation vs separation of concerns
When OOPL was introduced, encapsulation was one of the key features. Class variables had to be private and only accessed by methods. Because of this, a class had to implement all logic concerning the data it encapsulated. Later, it has been a lot of talking about separation of concern in OO design. You should have separate classes for persisting and displaying the data encapsulated in an object. This has lead to the use of getters and setters. Almost every variable has to be exposed by a corrensponding get and set method. My questing is: Isn't encapsulation and separation of concerns cont...

FIG-Forth on CP/M
Hello all, First, let me say that I am brand new here, and I am looking for some assis= tance with the (very) old FIG-Forth written for the 8080 microprocessor, an= d distributed among computer hobbyists in the late 1970s and early 1980s. I was introduced to Forth at about this time, and I have the first edition = "Thinking Forth" by Leo Brodie. I have played around with Forth from time = to time, and I used Forth running on Linux more than a decade ago when I wa= s taking a course on computer languages. So, my experience with Forth in g= eneral is light. At this sta...

gmres vs. bicg
I have a large sparse non-symmetric linear system Ax=b which I'd like to solve using one of the Krylov solvers that in Matlab. I have some idea how the methods work, but I am not clear on the comparative performance of gmres versus bicg (when to choose which). Could anyone kindly point me to a reference? Thanks, Gre ...

Speed
Hi All: I have stumbled into a situation that has left me somewhat confused. I have been using two Lexmark Optra S lasers and a Tektronix Phaser color laser on my 10/100 ethernet network. It's a small home network. I set this up for several convenience reasons. But one of my objectives in setting it all up was to gain a little speed in throughput of jobs compared to parallel connections. Recently I migrated to WinXP. Then my Phaser started to give me mysterious network problems. So as a temporary band-aid, I connected one Lexmark and the Phaser to my main PC with paralle...

Realtime X800 'Ruby' demo vs CG "Xbox" Raven
http://www.beyond3d.com/forum/viewtopic.php?t=12119 interesting comparison between the pre-rendered CG Raven-Robot demo that was used to hype the Xbox (March 2000) and the new realtime ATI X800 Ruby demo. As well as the pre-renderd Ruby CG and the realtime Nvidia GeForce 2 version of Raven-Robot demo. the point is, new realtime tech demos on new graphics cards are able to rival low quality CG of a few years ago, and to understand that Xbox 2 will be another step beyond todays new video cards. "R420" <radeonr420@yahoo.com> wrote in message news:51488ce2.0405041405.1144cd53@...

ASP.NET vs JSF
http://www.developer.com/net/asp/article.php/10917_3572721_1 Mirate este articulo, pero leetelo entero !!! -- ----------------------------------------------------- Antonio Santiago P�rez ( email: santiago<<at>>grahi.upc.edu ) ( www: http://www.grahi.upc.edu/santiago ) ( www: http://asantiago.blogsite.org ) ----------------------------------------------------- GRAHI - Grup de Recerca Aplicada en Hidrometeorologia Universitat Polit�cnica de Catalunya ----------------------------------------------------- ...

Common-lisp.net down due to attack
Common-lisp.net is down for maintenance due to an apparent break-in. No real time-frame for the attack is known yet; details will be supplied in time. This downtime period will probably be utilized for moving hosting to better premises where our sandboxing abilities should be better, even though that may extend the downtime somewhat. We apologise for the inconvenience, -- Nikodemus Siivola, on behalf on Common-lisp.net On Mon, 23 Aug 2004 23:36:59 +0000, nikodemus wrote: > Common-lisp.net is down for maintenance due to an apparent break-in. No > real time-frame for the attack is kn...

When did FORTH become Forth
Just curious, If I recall correctly, didn't Forth used to be FORTH? Blueeyedpop wrote: > Just curious, If I recall correctly, didn't Forth used to be FORTH? The IBM 1130 didn't do lower case. -jpd (co-developer of FORGO, a FORTRAN compile&go system for the 1130) Blueeyedpop wrote: > Just curious, If I recall correctly, didn't Forth used to be FORTH? Yes, back when we used A(or K)SR33s. Jerry -- Engineering is the art of making what you want from things you can get. ����������������������������������������������������������������������� When did we stop...

Help on starting with Forth
Hi I'm looking for some help with a few questions on Forth. I've had a browse around and looked at the FAQ but still have some questions. I am not a complete beginner as I used Forth back in the 80's on a BBC micro, MAC and some embedded systems. I have a little project in mind and I am fed up with Visual Basic so I thought I would relearn Forth. I grabbed a copy of Win32Forth and have that up and running on my PC. 1) Is there a simple explanation anywhere of how to get from typing at the console, to writing my own first program. ie setting up a project with directories, p...

Recursively seed fill alg VS iteratively seed fill alg,, help!!
I tried to modify the recursive seed filling algorithm(6-connected) to a iterative one, but FillRegion0, which is the iterative one, works uncorrectly, i list the code as follows, any oppinion about it will be deeply appreciatied!!!! // m_pData is a 3d array, used to save discrete infomation. void FillRegion1(int* seed) { // m_nNum1D==100, in order to provide a limitation if (seed[0]<0 || seed[1]<0 || seed[2]<0 || seed[0]==m_nNum1D || seed[1]==m_nNum1D || seed[2]==m_nNum1D ) { return; } if (m_pData[seed[0]][seed[1]][seed[2]]->IsVisit()) { return; } // do something with (x, y, z)...

Newbie data types question in printf vs iostream
When I declare a 64 bit integer (long long or __int64), it seems to have the same boundaries as a 32 bit int while using printf, but the correct 64 bit boundaries when using cout. Here's my code: #include <cstdio> #include <iostream> using namespace std; int main() { long long a = 2147483647; //The max value for a signed 32 bit int long long b = 9223372036854775807; //The max value for a signed 64 bit int printf("%d %d %d\n", a, a+1, b); cout << a << " " << a+1 << " " << b << endl; return 0; } --- Here's m...

pthread cond signal vs broadcast
I'm wondering about the two functions pthread_cond_signal and pthread_cond_broadcast... Under what circumstances is it more appropriate to call one rather than the other? Which one is the more usual choice? -- Magic depends on tradition and belief. It does not welcome observation, nor does it profit by experiment. On the other hand, science is based on experience; it is open to correction by observation and experiment. Daniel T. wrote: > I'm wondering about the two functions pthread_cond_signal and > pthread_cond_broadcast... Under what circumstances is it mor...

NYC LOCAL: Sunday 24 August 2003 Three Jewels Free Software Workshop: Volunteers Meeting and Introduction to Lisp
Sunday 24 August 2003 there will be a Free Software Workshop at Three Jewels Refuge and Free Internet Cafe 211 East 5th Street east of Third Avenue Island of the Manahattoes Subway: Eighth Street stop on the N, R, sometimes W, lines; Astor Place on the 6 line; Third Avenue on the crosstown L line; Lower East Side-Second Avenue-Houston Street on the F, V lines Note that some of these lines may not be running right this weekend. The Workshop will start at 3:00 pm and run until 9:00 pm. Between 3:00 pm and 5:00 pm we will organize actions to bring free software to New York City schools and...

SP 4 vs. FF3
What's the difference between SP4 and FF3? Which is more realistic? I have Windows ME, 1ghz, 256 ram, GF 3 card... Will FF3 run on my comp? Thanks, J On Sun, 03 Apr 2005 01:21:59 GMT, Jiyang Chen wrote: >What's the difference between SP4 and FF3? Which is more realistic? I have >Windows ME, 1ghz, 256 ram, GF 3 card... Will FF3 run on my comp? I think there's not much between the two - though my personal preference is FF3. Both require a *lot* of re-learning with resperct to weapons systems etc. You may be pushed to getting a decent framerate on yo...

Fiber vs. thread
Do fibers in a thread run concurrently, like threads in a process? We often see: "The thread 'Win32 Thread' (0xcd2) has exited with code 0 (0x0)". Should exit codes for all threads always be 0 Ok? Thanks for your help! alexwu wrote: > Do fibers in a thread run concurrently, like threads in a process? No -- you must switch fibers manually using SwitchToFiber. > We often see: "The thread 'Win32 Thread' (0xcd2) has exited with code > 0 (0x0)". Should exit codes for all threads always be 0 Ok? This value comes from the call to ...

FORTH Poem by Julian Noble, inscribed into an old copy of Scientific Forth
I recently found a reasonably priced second-hand copy of Julian Noble's Scientific Forth on the Internet and have just received it in the post. To my delight, it has a lengthy inscription, hand-written, and signed by him, and dated 26 April 1992. I'm re-printing it here for the interest of other Forthers. There is one word (a name perhaps?) in the last verse that I'm not sure I can make out. I've put these in parentheses. If anyone can think of a different reading, please do suggest. (reposting -- corrected a couple of typos) - Assad To Abe, my once and futu...

haskell vs lisp
talk to me! or point me to the epic discussionas On Nov 22, 8:32=A0am, gavino <gavcom...@gmail.com> wrote: > talk to me! > > or point me to the epic discussionas You are either mad, or both! :) gavino wrote: > talk to me! No. > or point me to the epic discussionas Yes: http://groups.google.com/group/alt.troll On Tuesday, November 22, 2011 10:12:58 AM UTC+1, Norbert_Paul wrote: > gavino wrote: > > talk to me! > No. > > or point me to the epic discussionas > Yes: http://groups.google.com/group/alt.troll Thanks Norbert, I was too lazy to answer :) ...

procedure overloading vs. ?
Hi! Can=B4t I overload a procedure and, depending on the type of parameter passed do different things? I works for different base types (e.g. boolean vs integer) but I can=B4t get to compile this: architecture sim of my_entity is ..=2E procedure one ( variable x : std_logic_vector(1 to 4) ) is begin ..=2E. end procedure; procedure one ( variable x : std_logic_vector(1 to 8); ) is begin ..=2E end procedure; begin ..=2E end; The tool complains about two bodies for the same subprogram or, in a package declaration, that a redefinition would happen... Any workarou...

conditional expressions [[ ]] vs. [ ]
With bash, I see that using [[ ]] instead of [ ] with conditional expressions will let you match a pattern on the right side: myvar=aabbcc if [ "$myvar" == *bb* ]; then echo "we have a match" fi if [[ "$myvar" == *bb* ]]; then echo "we have a match" fi This shows that only the second form, [[ ]], does a pattern match. Question: Are there other reasons to prefer [[ ]] over [ ] for use with conditional expressions? And vice versa, are there reasons to prefer [ ]? -- A: Maybe because some people are too annoyed by top-posting. Q: Why do I...

Scrubbing Bubbles Automated Shower Scraper Leading five Non-Chemical Cleaning Tools You'll be able to Use
Scrubbing Bubbles Automatic Shower Cleaner Prime 5 Non-Chemical Cleaning Tools You'll be able to Use [img]http://t0.gstatic.com/images?q=tbn:ANd9GcR5AwWwE0Pxxww4pzMaUBq_d1_oDO9xruHzSo5-cxBSS9lTo8hE[/img] It seems that each and every day you learn more and much more just how dangerous and polluting cleansing solutions might be. There is far more to those items than simply their price tag tag as well. These chemical centered products cost you environmental air pollution and lengthy phrase well being issues for example asthma, allergic reactions, bronchitis and sinusitis. Consumers ...

TCPIP Failsafe vs ARP Cluster alias
I remember seeing complaints here that the good old Arp based cluster Alias had been replaced in recent alpha version of TCPIP Serviced with the Failsafe service. (in particular the removal of the TCPIP> SET INT /CLUSTER=ip /C_network= /C_broadcast= command. In reading the Failsafe chapter, they mention that the same capabilities as the arp based cluster can be achieved by using ifconfig to create an alias IP address on the interface and not starting the Failsafe service. (or something to that effect). However, much earlier in that manual, there is still mention of the ability to c...