Re: Java and C
Re: Java and C
- Subject: Re: Java and C
- From: Brian Hill <email@hidden>
- Date: Wed, 29 Aug 2001 11:05:09 -0500
On Wednesday, August 29, 2001, at 10:18 AM, John Balestrieri wrote:
Is there any performance hit when switching from the Java VM to native
compiled code?
Yes. Each time the code needs to cross the 'Java Bridge', it needs to go
through a number of translation routines to convert things like
parameters back and forth. It's normally not that noticeable, but if you
do it 1000 times in a loop, you will definitely notice it.
This was one of the main reasons, for example, that the underlying
EOGenericRecord implementation was switched between WO 4.0 and WO 4.5.
It was faster to store all the object attributes in a single
NSDictionary and pass that single object back and forth across the
bridge than to access each individual instance variable separately
across the bridge. I'd keep this in mind if you find yourself doing any
intensive processing on the Java side.
Are there any 'gotchas' to watch out for when working in Java with
classes that were created in Objective C? Vice versa?
There was a lot of information regarding the Java Bridge discussed while
WO 4.5 was current. I'd suggest a search of the Omni WebObjects
developer archives for 'Java Bridge'.
I recall one of the more persistent issues was the issue of things
getting garbage collected/released on one side of bridge while they were
still needed on the other side of the bridge. I believe the workaround
for that sort of thing was to stuff the 'bridged' object into a
Foundation-based collection (like NSArray) on the Java side.
I'd check the Omni WO Dev archives for the tips on this if you run into
these problems. I haven't used the Java Bridge that much.
Am I wrong all together to think that the languages can be mixed as
I've described?
Nope. It should work.
Brian
email@hidden
http://personalpages.tds.net/~brian_hill
___________________________________________________________
"Why? I came into this game for adventure - go anywhere, travel
light, get in, get out, wherever there's trouble, a man alone.
Now they've got the whole country sectioned off and you can't
move without a form. I'm the last of a breed."
-- Archibald "Harry" Tuttle, Rogue HVAC Repairman
___________________________________________________________
References: | |
| >Java and C (From: John Balestrieri <email@hidden>) |