my dog learned polymorphism*
The moose likes XML and Related Technologies and the fly likes Native XML parser. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Native XML parser." Watch "Native XML parser." New topic
Author

Native XML parser.

Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Now as more of more J2EE based application are relying on XML and java based xml parsers are quite slow as compared to the parsers written in native languages like C and C++.Can this be done for improving the speed at which parsing is performed.

Can we not have the core parsing library written in native language and then using native methods from java to access those , so that the parsing becomes fast , real fast.

Though this would make the application dependent of on some OS specific codes.Java will lose the portability but the speed can be must faster that what it is now.

What are the problems that I may enounter if i decide to work on this ?, Is there is already something like this in this space?


Rahul Bhattacharjee
LinkedIn - Blog
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Can we not have the core parsing library written in native language and then using native methods from java to access those , so that the parsing becomes fast , real fast.

So what kind of data structure are you going to build? Java libraries are built around parsers that create Java objects. It is not enough to parse rapidly, you also have to get access to the data you parse.

There are tremendous differences in speed between different techniques within Java - DOM versus SAX, XPath versus more direct methods, etc. etc. - the technique should match the problem and the real problem identified before you go dashing off in all directions.

Is this another "Java is slow" programmer myth or do you have real data.

Bill
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
but the speed can be must faster that what it is now.

Why? The native-to-Java interface simply gets moved to a different layer; it's not clear to me that this would necessarily be faster. Remember that Java is native code - todays JVMs contain quite sophisticated compilers.

As an example where pure Java is faster than using a native library, have a look at the BigDecimal class (and maybe BigInteger as well). It used to be a wrapper around a native library, and got much faster when it was rewritten in pure Java. Of course, there, no native code is running at all, since there's no I/O involved, so the overhead of the native-2-Java interface was in fact removed.


Ping & DNS - my free Android networking tools app
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
I was under the notion that java is slower than other languages.But I did not realize that it might again be much slower if we try to use native libraries using java.If that is the case then can we not make the native method intern() of string class to a pure java method.Can we not maintain the string pool in the heap itself ?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Believe it or not, many many thousands of programmer hours have been expended at Sun, IBM, and other top programming shops in an effort to make Java faster and more efficient over the last 10 or so years. After all, serious money is involved!

I suspect that all the obvious ways to make Java faster have been thoroughly investigated. The present Java is five or six generations from the 1.02 version I worked with over 10 years ago.

There is still plenty of room for improvement in the Java libraries - witness the explosion of open source toolkits at places like sourceforge, so I am not trying to discourage you from seeking improvements, just pointing out that the obvious has already been explored.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Native XML parser.