String consisting of spaces

P

Paul Lutus

skeptic said:
Sorry, that's complete BS.

Post your evidence. Many parts of Java are written in native code for
performance reasons. It is too fast to be pure Java, and there are any
number of reasons to do it this way.
 
M

Mark Thornton

Paul said:
skeptic wrote:




Post your evidence. Many parts of Java are written in native code for
performance reasons. It is too fast to be pure Java, and there are any
number of reasons to do it this way.

java.math.BigInteger used to be implemented using native code, but the
current version is pure Java --- and faster than the previous native
code version!

Mark Thornton
 
T

Tor Iver Wilhelmsen

Paul Lutus said:
Post your evidence. Many parts of Java are written in native code
for performance reasons. It is too fast to be pure Java, and there
are any number of reasons to do it this way.

Why do you want him to break the JDK license by posting Sun source?
Are you unable to open src.zip to check yourself?

The word "native" does not appear in any of the four source files for
the java.util.regex package. The only import of note is
sun.text.Normalizer, for which you need a separate license to see the
source. But thanks to the magic of javap we can check the class
structure, and lo and behold: That class is also absent of any native
methods.

Satisfied?

(Also: Precompiled binary isn't necessarily faster than on-the-fly
compiled binary.)
 
P

Paul Lutus

Tor said:
Why do you want him to break the JDK license by posting Sun source?

I never asked for this. In any case, it appears I am wrong about this. I
have been impresssed with the speed of the Java regex functions, and after
comparing it to Perl's processing speed, I made an assumption.
 
P

Paul Lutus

Mark Thornton wrote:

java.math.BigInteger used to be implemented using native code, but the
current version is pure Java --- and faster than the previous native
code version!

In any case, I am apparently wrong about the regex functions. I just found
them to be rather fast, and I made an assumption.
 
R

Raymond DeCampo

VisionSet said:
VisionSet wrote:

char[] spaces = new char[s.length()];

for(int i = 0 ; i<spaces.length; i++)
spaces = ' ';


java.util.Arrays.fill() might be better here.



No it does it the same way, except it goes via fill(char[] a, int fromIndex,
int toIndex, char val) and hence throws in the usual public method parameter
checks, so if anything slightly longer.

Well that is quite disappointing. I figured that the fill() methods
would be native methods and use the corresponding C function memset()
for efficiency.

Ray
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top