A Conversation for The H2G2 Programmers' Corner

Java code?

Post 61

DoctorMO (Keeper of the Computer, Guru, Community Artist)

You see, things like Java and Visual Basic will never be fast, the reason? because the compiler or filter isn't good enough to know exactly what you want to do, so they have to put in lots of error checking and viarous other bits of code to stop windows dying a death. the only was to create fast code is to write native in the PC case Assembler so if you want speed you know were to look, the idea behind Java is programs that can run on many difrent machines maby not fast but they do the same things and that my friends is what counts (not unless somebody comes up with a pritty funky nural network based lanuage)

-- DoctorMO --


Java code?

Post 62

Pastey

cross compatability would be nice, the other option would be to make everyone use the same system, so come on everyone! Throw out those Macs! Uninstall Unix!!

Actually, don't bother smiley - winkeye

smiley - rose


Java code?

Post 63

Peet (the Pedantic Punctuation Policeman, Muse of Lateral Programming Ideas, Eggcups-Spurtle-and-Spoonswinner, BBC Cheese Namer & Zaphodista)

DoctorMO, at the risk of flogging a dead interpreter, you should have a look at Forth - it was written from the outset to be cross-platform compatible, and a "direct threaded" architecture can approach one-fifth the performance of optimised machine code... (*)

It's a strange language to learn - it's stack-oriented, integer-only and operates exclusively in RPN. It has no low-level graphics or sound routines as standard. However, if you don't mind losing a little of the (quite astounding) performance, there are a number of floating point libraries available in the public domain, and if you're willing to lose a little of the "generality" of the language PC, Mac, BBC, Amstrad etc. specific graphic extensions abound. Every "Word" you define (in this context, "Word" is the Forth term for a subroutine, rather than a unit of data size) is automatically available to be called by all later "Words", something like a "library" in C or Java. Oh, and a fully functioning core specification Forth interpreter can fit into 8K... Yes, "K"! My favourite quote: "There are two kinds of programmer; those who love Forth and those who don't understand it"

(Forth programmer in-joke: I used to have a tee-shirt which said

: GO FORTH & * ;

Pronounced "Go Forth and multiply", it's a valid, if pointless, statement in Forth, which defines the word "GO" to switch to the FORTH core vocabulary, perform a boolean AND of the two top stack items and multiply them by the third, leaving the result on the stack. smiley - geeksmiley - laugh )

(* I read that somewhere a *long* time ago, when I was playing with Forth on a regular basis. I have no idea how the figure was calculated, but having used the language on a number of 8 and 16 bit CPUs, I have no reason to doubt it.)


Java code?

Post 64

DoctorMO (Keeper of the Computer, Guru, Community Artist)

Well, I supose it's just that people esp older people don't realy like to learn more that 200 lanuages, me I'd like to stick to Functions and Subs, Registers and Stacks.

Posiblitys for the future for me as I'm young and able.

-- DoctorMO --


Java code?

Post 65

Moonglum Clampflower (MornC), Muse of Ego, Keeper of the Lamp and Guru, (aka Happinose)

I believe I'm right in saying that C allows you to write "close" to assembler and so can produce PDQ code. Visual C, not so sure about, but there is really no need to resort to assembler. The lowest I've got in programming was hand assembling 6502 assembler in to machine code which I then typed in to a front panel on an Apple II. Hours of work and very little to show for it.

One thing that's probably worth saying is that the compiled code of Visual Basic is coming up to the speed of Visual C, so, with time, any language can be developed to be efficient. The bad point is that if the languages keep changing then you'll never get good fast efficient code that's easy to produce coz you'll be starting from scratch again and again.

smiley - crescentmoonsmiley - biggrin


Java code?

Post 66

Dancer (put your advert here)

Well, if you stick to certain limitations, C/C++ is cross platform (No disk access nor graphical libraries...) but most programming requires API calls... so libraries are used. It is hard to create something cross platform because different platforms are made with different concepts behind them (e.g. MSWindows:Greed Unix:Ingenuity BeOS:Ease of use ...)

smiley - hsif
Dancer


Java code?

Post 67

Dancer (put your advert here)

I hope this won't be moderated for being defermatory smiley - smiley

smiley - hsif
Dancer


Java code?

Post 68

Moonglum Clampflower (MornC), Muse of Ego, Keeper of the Lamp and Guru, (aka Happinose)

I doubt it. Slander is based on opinion whereas you are being factual. smiley - smiley

smiley - crescentmoonsmiley - biggrin


Java code?

Post 69

MaW

True.

There are some cross-platform solutions being developed for C/C++ though. Trolltech's Qt is one, although it's only free on UNIX smiley - sadface however, it does provide an identical GUI API on Windows, if you want to pay for it...

Disk access in C and C++ is the same on most OSes, although you do run into the stupid distinction Windows has between text and binary files.


Java code?

Post 70

DoctorMO (Keeper of the Computer, Guru, Community Artist)

Right I will say this, Assembler is fast, C++ or C is NOT nearly as fast because it is compiled Native coding that means it has to change it into assembler and because of inconsitenies between You and the Computer It can never be a fast.

-- DoctoRMO --


Java code?

Post 71

MaW

Of course it can't, although modern optimising compilers and fast processors make it less necessary to code in assembler for most programming tasks. Besides, who wants to code in assembler? C++ gets bad enough sometimes, especially on Windows.


Java code?

Post 72

DoctorMO (Keeper of the Computer, Guru, Community Artist)

Assembler isn't that bad, but your right letts all be narow minded and asume people have fast PCs 3D FX cards and lots of other things. I'm sorry but with the event of fast PC, Assembler will go even faster and that my friend is breakneck speed. C is for the college types because you can have assembler in C and it will compile the assembler into your programming which means there realy is no excuses to learn a little bit.

-- DoctorMO --


Java code?

Post 73

Dancer (put your advert here)

Actually, in the PC market, Assembler is rarely used to optimise code these days, it is used for really low level stuff and other issues (e.g. stack manipulation and dynamic functiuon calls as necessery in plugin DLLs etc.)

RT and Embedded programming uses C and Assembler quite a lot though, as every cycle counts on those systems.

Compilers know how to optimise code quite well these days, either for speed or final file size. And a lot of times the mess you would get from using assembler in large complicated algorythms will bcause the code to actually be slower, and if not, much less debuggable!

I also saw that Watcom C++ (which was a verry fast and well made compiler) is being revived as an open source project now .


smiley - hsif
Dancer (Loves to use Assembler when needed, and happy when it's not needed)


Java code?

Post 74

DoctorMO (Keeper of the Computer, Guru, Community Artist)

Well, I gues when you step into C++ or C first then you would have that atatude, it's just that I went strait from VB to Assembler and the difference is increadble. but I bet your now going to tell me that Assembler can be slower, Oh whops you did that already, are you on medication when you say that because you would realy need to be a begginer or maby just a CEO to not get faster code.

smiley - winkeye (nice when we can have a debate without a flame smiley - smiley)

-- DoctorMO --


Java code?

Post 75

Dancer (put your advert here)

If you are making a simple part of the program in Assembly, you might be right, you need to rally be used to suites to do it slower then the C/C++ code.

When you want to make, for instance, a radiocity algorythm (an almost dead, quite nice way of 3D rendering), you'll have to be quite cazy in order to decide to make it in assembly, plust it'll probably be so messy that any changes, additions and debugging will either be impossible or VERRY time consuming, plus it is not guranteed to be faster then the C code.

smiley - hsif
Dancer


Java code?

Post 76

DoctorMO (Keeper of the Computer, Guru, Community Artist)

Any algorims that use loops of any kind are garatied to be faster because of the pure resoning or the human mind vs a computer there realy is no compotishion. I think your right about doing large projects from scratch but thats not what I mean, doing a whole project is stupid unless it's small and even then....

right what I mean is functions things that are called again and again by other programs or in other places in the code. you can build up a whole program mearly on functions (thats what VB does smiley - winkeye)

-- DoctorMO --


Java code?

Post 77

MaW

Isn't that what any procedural language does? Or a functional language for that matter. Programs are simply calls to functions, which in turn contain calls to functions or procedures or subroutines or whatever you want to call them, which eventually make their way all the way down to something the CPU can understand that's in binary. The trick is making the gap as small as possible so that every possible operation can be completed in as few CPU cycles as possible. However, that's not always simple to do, and there's still the RISC versus CISC argument (although it looks like RISC has won, considering that most modern processors have RISC cores even if they do have a CISC instruction set on their microcode layer). Hand-coding in assembler could indeed make it possible to make things go exceptionally fast, but one has to consider if the development time is worth it. Besides, if one is a careful programmer, C can go like lightning, and there are only a few applications where you need the extra few microseconds assembler can give. I don't think they even bother to write games in assembler very much anymore.

Oh yes, and I don't think I'm narrow-minded in assuming people generally have fast processors - have a look around and tell me what you see (and not just in your room full of 386s, look somewhere else as well, get a fairer sample, hmm? The computer science terminal room I'm sitting in now is full of 400MHz PIIs for starters. I can't think of hardly anyone I know with a PC with less than 350MHz processor, most of them are at 600 or more). And when was the last time you tried to buy a computer? It's almost impossible to find anything that goes slower than 800MHz now, unless you get a reconditioned system.

As for radiosity rendering, it's not dead, it's the method used to simulate interdiffuse reflection in POV-Ray and some commercial 3D renderers.


Java code?

Post 78

Dancer (put your advert here)

Glad to hear it's still used, I really liked playing with it, and always though it's quite a nice little thing, as once you copleted the calculations, you can move inside and reposition the camera with little further calculations (only repositioning everything, but no need to recalculate the colors of every surface.

About the computers, well, I have an AppleIIe I'm still trying to make work, 2 486s (only one is in use) and 2 old pentiums, plus the new faster peice smiley - smiley I think only the "fossiles" and computer people have old computers, and also have new ones as well, mots people have reletively fast machines. It is not too expensive to buy a fast computer, and there's a veraity of good, cheap, lightning fast AGP video cards.

smiley - hsif
Dancer


Java code?

Post 79

MaW

Yup, and it's just wonderful... I'm personally running an 800MHz Athlon Thunderbird with 256MB of SDRAM and a Voodoo4 4500AGP. That last is irritating, but good enough for most things - although I really want one of those GeForce3s...


Java code?

Post 80

Dancer (put your advert here)

I use a GF3 smiley - biggrin

smiley - hsif
Dancer


Key: Complain about this post

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more