swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WorkingExampleCode divided among C, Objc, and Java


From: Marcus G. Daniels
Subject: Re: WorkingExampleCode divided among C, Objc, and Java
Date: 17 Dec 1999 11:20:56 -0800
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4

>>>>> "PJ" == Paul Johnson <address@hidden> writes:

PJ> The effect has to do with alignment and the compiler's tendency to
PJ> align larger items in a way that does not make the most efficient
PJ> use of the space.  The point: to reduce memory usage, you should
PJ> always include items in a structure from smallest (in bits) to largest. 

In a forest-through-the-trees kinda way, doesn't this seem just a
little bit ridiculous?

When Objective C was chosen as the language to use for Swarm, part of
the reason was that a lot of people know C.  I suggest that, although
I think this was a reasonable strategy, in fact, many if not most
people using C for modeling don't really understand or check the
consequences of their actions by studying the compiler's assembly or
by doing profiling.  After all, the goal is to gain some understanding
of a phenomenon, not to learn about RISC architecture and cache
dynamics (unless the modeler happens a computer scientist).

Traditionally, C has been a useful language for system implementors
because it can be used as more-or-less a portable assembly. 
In general, you can ask for something and be confident that it maps to
the hardware in a predictable way.  C compilers typically have
language extensions and flags to guide the optimizer in cases where
the optimizer might end up being be too smart.  

It would be better, it seems to me, if ABM modelers (presumably being
people high in descriptive ability), had a tool that where they
could describe all the agents and their relationships and the tool
would take care of mapping that efficiently to various kinds of
systems.  Objective C Swarm has the problem that it in some sense it
is `listening' with system-implementation, not modeling sensitivities.

Unfortunately, the situation isn't just a matter of Swarm 
having an attitude problem.  As a practical matter, the evolved compilers
have been oriented toward C.  If you wanted to target a lot of platforms,
you use a GCC language or work hard to write portable C.

Java is a step forward.  Java is a garbage-collected, higher level
language than C and it has a portable executable representation.
There is a lot of money behind it, and it won't be long until
everything from cars to cell phones to toasters have java virtual
machines embedded in them.  Is Java perfect?  No.  Are Java programs
slower than well-coded C compiled by a modern C compiler.  Probably.
But what people should realize is that it isn't trival to tease out
optimal performance from a C program.  Increasingly, that kind of
knowledge can and should be left to professional compiler hackers.  
A language like Java is better-suited than C for this division of labor
because it has stronger typing.  The user is required to provide
typing information, and is not allowed to violate it with pointers.
The Java user is not a micromanager, but the skilled C user tends to be.


                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]