Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #35648

Re: Java is faster!

From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Java is faster!
Date 2016-09-25 14:44 -0400
Organization A noiseless patient Spider
Message-ID <ns95v0$m1h$1@dont-email.me> (permalink)
References <faster-20160923143035@ram.dialup.fu-berlin.de> <1l9fub927k9tntoli9cddnfil6e4o74are@4ax.com> <ns93lq$fpv$1@news.albasani.net>

Show all headers | View raw


On 9/25/2016 2:05 PM, j4n bur53 wrote:
> Since Java is typesafe, and this typesafety goes
> vary far, recently, after much time, I have
> even created a runtime error when assigning
> an array cell, so the component type of the array
> didn't match the element type.

     Many Java programmers consider this a Good Thing.

> I think there is a general limit. This typesafety
> is still ingrained in the runtime. Although casts
> are highly optimized, they don't go away. I recently
> made some other experiments, and bumpted my head
> speed wise just because of the many casts I needed.

     How did you measure the time consumed by the casts?  That is,
what kind of experiment did you perform to accomplish "the same"
computation without the casts?

     Hmm: I suppose you could re-write your classes to use Object
references instead of Strings and JButtons and so on, and insert
casts as needed:

	// String s = "Hello";
	Object s = "Hello";

	// int length = s.length();
	int length = ((String) s).length();

... for some very large set of references, and then compare the
run times of the cast-free and cast-heavy versions.  Did you do
something of that kind, or measure the penalty in some other way?

-- 
esosman@comcast-dot-net.invalid
The Tooth Fairy has gone high-tech, now pays in Bitecoin.

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Java is faster! Roedy Green <inquiry@mindprod.com> - 2016-09-25 03:28 -0700
  Re: Java is faster! j4n bur53 <janburse@fastmail.fm> - 2016-09-25 20:05 +0200
    Re: Java is faster! Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-09-25 14:44 -0400
      Re: Java is faster! j4n bur53 <janburse@fastmail.fm> - 2016-09-26 23:09 +0200
        Re: Java is faster! Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-09-27 10:51 -0400
          Re: Java is faster! Sebastian <nowhere@nirvana.org> - 2016-09-28 23:50 +0530
            Re: Java is faster! Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-09-28 15:14 -0400
              Re: Java is faster! j4n bur53 <janburse@fastmail.fm> - 2016-09-29 09:11 +0200
    Re: Java is faster! Arne Vajhøj <arne@vajhoej.dk> - 2016-09-29 21:24 -0400
  Re: Java is faster! Jerry Stuckle <jstucklex@attglobal.net> - 2016-09-25 16:37 -0400
    Re: Java is faster! Eric Douglas <e.d.programmer@gmail.com> - 2016-09-26 05:47 -0700
      Re: Java is faster! Robert Klemme <shortcutter@googlemail.com> - 2016-10-04 23:04 +0200
  Re: Java is faster! Arne Vajhøj <arne@vajhoej.dk> - 2016-09-29 21:18 -0400

csiph-web