Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. I wonder what will give me the best performance

I wonder what will give me the best performance

Scheduled Pinned Locked Moved The Lounge
performancequestioncsharpc++java
20 Posts 14 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Mike HankeyM Mike Hankey

    There's always assembler if you're really bored. :)

    As the aircraft designer said, "Simplicate and add lightness". PartsBin an Electronics Part Organizer - Release Version 1.3.0 JaxCoder.com Latest Article: SimpleWizardUpdate

    pkfoxP Offline
    pkfoxP Offline
    pkfox
    wrote on last edited by
    #11

    Good answer Mike :thumbsup:

    In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity. - Hunter S Thompson - RIP

    1 Reply Last reply
    0
    • C Cp Coder

      I want to write a medium sized project for Windows and I am considering the following options: A: Write it in JavaFX, which means I will end up with a standard Windows MSI installer that will install a native Windows exe. B: Write it in Kotlin which means I will end up with a Java Jar file that will run under Java on my Windows rig. I am not really interested in C# as I got bored with it. The question is: Which option will perform best speed wise? Any ideas out there?

      Ok, I have had my coffee, so you can all come out now!

      J Offline
      J Offline
      Jan Heckman
      wrote on last edited by
      #12

      Others have already done the funny and relevant answers. On the boring side, then: - what makes your app need (more) performance? CPU, GPU, disk IO which of the/any lot? - if you anticipate need for tuning, use a language which has (decent interaction with) a profiler. After all, optimizing software (in any language) usually gives better performance upgrades then the choice of language, extremes excluded.

      C 1 Reply Last reply
      0
      • J Jan Heckman

        Others have already done the funny and relevant answers. On the boring side, then: - what makes your app need (more) performance? CPU, GPU, disk IO which of the/any lot? - if you anticipate need for tuning, use a language which has (decent interaction with) a profiler. After all, optimizing software (in any language) usually gives better performance upgrades then the choice of language, extremes excluded.

        C Offline
        C Offline
        Cp Coder
        wrote on last edited by
        #13

        I suppose one of the things I wonder about: I understand that a jar file runs under Java as an interpreted item, not as a native exe. That makes me wonder if the jar file is not going to be significantly slower?

        Ok, I have had my coffee, so you can all come out now!

        J O E 3 Replies Last reply
        0
        • C Cp Coder

          I suppose one of the things I wonder about: I understand that a jar file runs under Java as an interpreted item, not as a native exe. That makes me wonder if the jar file is not going to be significantly slower?

          Ok, I have had my coffee, so you can all come out now!

          J Offline
          J Offline
          jweled
          wrote on last edited by
          #14

          To my knowledge jars are precompiled, not interpreted. Also, jars can run on any platform that runs Java which can be handy for easy distribution.

          1 Reply Last reply
          0
          • C Cp Coder

            I suppose one of the things I wonder about: I understand that a jar file runs under Java as an interpreted item, not as a native exe. That makes me wonder if the jar file is not going to be significantly slower?

            Ok, I have had my coffee, so you can all come out now!

            O Offline
            O Offline
            obermd
            wrote on last edited by
            #15

            The last time I checked jar files are compiled into machine executables on the first run, so only the initial run will require the interpreter/compiler and the rest will run at full speed. The biggest question for performance is do your algorithm choices perform well on the hardware, both from a theoretical sense (bubble vs. quicksort) and from a hardware resource sense (huge arrays vs. small data structures).

            J 1 Reply Last reply
            0
            • C Cp Coder

              I want to write a medium sized project for Windows and I am considering the following options: A: Write it in JavaFX, which means I will end up with a standard Windows MSI installer that will install a native Windows exe. B: Write it in Kotlin which means I will end up with a Java Jar file that will run under Java on my Windows rig. I am not really interested in C# as I got bored with it. The question is: Which option will perform best speed wise? Any ideas out there?

              Ok, I have had my coffee, so you can all come out now!

              S Offline
              S Offline
              Shmoken99
              wrote on last edited by
              #16

              How do you get bored with a language? I don't care what language I have to use, it's all about solving the users' problems. That said, it sounds like you have the luxury of choice and want to learn new skills? No I guess I'm just jealous. Who's going to have to support this after you? Would JavaFX or Kotlin or other make this better or worse for them?

              1 Reply Last reply
              0
              • O obermd

                The last time I checked jar files are compiled into machine executables on the first run, so only the initial run will require the interpreter/compiler and the rest will run at full speed. The biggest question for performance is do your algorithm choices perform well on the hardware, both from a theoretical sense (bubble vs. quicksort) and from a hardware resource sense (huge arrays vs. small data structures).

                J Offline
                J Offline
                jschell
                wrote on last edited by
                #17

                obermd wrote:

                I checked jar files are compiled into machine executables on the first run

                I don't believe so. First of course it would not do that to a jar file. Classes are loaded from a jar file and then methods are run for that class. Methods might be compiled if the VM deems it is worthwhile. I suspect however that the 'compiled' version might have a different form than if one did the same method in C/C++ and created a binary image from it. For starters I would expect complications for accessing method variables, instance and class variables and method parameters. As an example of that in C/C++ if one attempts to dereference a method variable that is null then the system will throw the exception. However in Java it is going to need to check that so it can throw the appropriate Java exception instead. So it cannot do it as directly as C/C++ code would.

                T 1 Reply Last reply
                0
                • C Cp Coder

                  I want to write a medium sized project for Windows and I am considering the following options: A: Write it in JavaFX, which means I will end up with a standard Windows MSI installer that will install a native Windows exe. B: Write it in Kotlin which means I will end up with a Java Jar file that will run under Java on my Windows rig. I am not really interested in C# as I got bored with it. The question is: Which option will perform best speed wise? Any ideas out there?

                  Ok, I have had my coffee, so you can all come out now!

                  J Offline
                  J Offline
                  jschell
                  wrote on last edited by
                  #18

                  Cp-Coder wrote:

                  Which option will perform best speed wise? Any ideas out there?

                  As suggested elsewhere that question is typically meaningless when one looks only at individual technologies. One needs to look at what the application will do and then decide on appropriate technologies (plural) to optimize for the point of the application. Quite possible that speed is not even a consideration depending on what it is doing (not in the context of how fast either might perform based on the application needs.)

                  1 Reply Last reply
                  0
                  • C Cp Coder

                    I suppose one of the things I wonder about: I understand that a jar file runs under Java as an interpreted item, not as a native exe. That makes me wonder if the jar file is not going to be significantly slower?

                    Ok, I have had my coffee, so you can all come out now!

                    E Offline
                    E Offline
                    englebart
                    wrote on last edited by
                    #19

                    Java uses JIT, Just in Time, compilation, so the execution can be tuned to the exact CPU it is running on by the runtime. 32bit architecture, 64bit architecture, etc

                    1 Reply Last reply
                    0
                    • J jschell

                      obermd wrote:

                      I checked jar files are compiled into machine executables on the first run

                      I don't believe so. First of course it would not do that to a jar file. Classes are loaded from a jar file and then methods are run for that class. Methods might be compiled if the VM deems it is worthwhile. I suspect however that the 'compiled' version might have a different form than if one did the same method in C/C++ and created a binary image from it. For starters I would expect complications for accessing method variables, instance and class variables and method parameters. As an example of that in C/C++ if one attempts to dereference a method variable that is null then the system will throw the exception. However in Java it is going to need to check that so it can throw the appropriate Java exception instead. So it cannot do it as directly as C/C++ code would.

                      T Offline
                      T Offline
                      trønderen
                      wrote on last edited by
                      #20

                      jschell wrote:

                      obermd wrote:I checked jar files are compiled into machine executables on the first run I don't believe so.

                      Unless Java has changed a lot the last few years, and I am quite sure it hasn't, you are right. But in the beginning, there was Java bytecode, and bytecode was interpreted directly. Just like the Pascal "P4" bytecode, which is said to be an essential inspiration for Java bytecode. I never heard of any compiler for Pascal P-code; it was always interpreted (as far as I know - correct me if I am wrong). Bytecode is just like any other binary instruction set. 'Compiling' Java bytecode for, say, Aarch64 is functionally identical to compiling x86 binary code into Aarch64 binaries, except that x86 is so messy that it is no simple task :-). When Apple Mac switched from PPC to x64, lots of code was compiled from binary PPC to x64. PPC is far tidier than x86, so I guess that job was simpler. A binary instruction set, whether a 'real' one or bytecode for a virtual machine, usually carry a minimum of 'why-information', limited to 'what-information'. If the compiler could know why so-and-so binary code was generated, it would have greater opportunities to generate more optimal code for the target machine. Or rather: It would be a lot easier. If you compare Java binary bytecode with .net IL (Intermediate Language), IL is not suitable for (or intended for) direct interpretation, but it contains a lot more of 'why-information', making it easier to generate optimal target code. .net IL has always been compiled to native code before execution. When compilation of Java bytecode was introduced, the essential reason was to keep up to speed with .net, which claimed the same 'compile once, execute everywhere'. (For all directly compilation from source code to native code, noone expected interpretation of bytecode to be able to complete.) At about the same time, we also got Java compilers generating native code executables, rather than bytecode, to obtain maximum execution speed, but sacrifying the 'compile once, execute everywhere.

                      First of course it would not do that to a jar file.

                      If you refer to the compilation to add to the jar file, you are most certainly correct. The compiler could do like the .net IL compiler: It maintains a persistent cache (in the file system) of compiled assemblies. Before starting compilation of an assembly, the jitter ('Just-In-Time compiler') checks the cache

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups