On Java and C++

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Remon van Vliet

    Re: On Java and C++


    "Luc The Perverse" <sll_noSpamlici ous_z_XXX_m@cc. usu.edu> wrote in message
    news:798ii3xdnn .ln2@loki.cmear s.id.au...[color=blue]
    > "Remon van Vliet" <remon@exmachin a.nl> wrote in message
    > news:44565dcd$0 $31644$e4fe514c @news.xs4all.nl ...[color=green]
    >>
    >> "Luc The Perverse" <sll_noSpamlici ous_z_XXX_m@cc. usu.edu> wrote in
    >> message news:s61ii3xm0m .ln2@loki.cmear s.id.au...[color=darkred]
    >>> "Remon van Vliet" <remon@exmachin a.nl> wrote in message
    >>> news:445650da$0 $31651$e4fe514c @news.xs4all.nl ...
    >>>>
    >>>> "Chris Smith" <cdsmith@twu.ne t> wrote in message
    >>>> news:MPG.1ebffc fce1a489db9896a 0@news.astraweb .com...
    >>>>> Remon van Vliet <remon@exmachin a.nl> wrote:
    >>>>>> It can be, but with Java2D API you have access to hardware
    >>>>>> accelerated
    >>>>>> graphical features that should be on par with Flash performance. In
    >>>>>> my
    >>>>>> opinion everything that can be done in Flash can be done in Java.
    >>>>>> However,
    >>>>>> Flash is way more efficient from a time to market point of view, it's
    >>>>>> just a
    >>>>>> bit easier (and dare i say it better) for web based content.
    >>>>>
    >>>>> The problem is not with the performance of the graphics hardware. The
    >>>>> limiting factor is the initialization of the virtual machine.
    >>>>> Undoubtedly, if things got anywhere near the point of maxing out the
    >>>>> graphics card, an applet would greatly outperform Flash.
    >>>>>
    >>>>
    >>>> I know, but it's two different things, initialisation isnt in the way
    >>>> of performance and vice versa. That said, i can see how VM
    >>>> initialisation is a limiting factor. Having to wait 5+ seconds kind of
    >>>> shoots applets down as a good option for dynamic web content.
    >>>
    >>> I wonder if running the JVM as a process would eliminate this delay, or
    >>> at least greatly reduce it[/color]
    >>
    >> I think it sort of is after the first invocation. I cant say for sure
    >> though.[/color]
    >
    > Typically I am opposed to background services running - but if I could
    > make Java programs initial startup cost go away, I could sacrifice a few
    > MB.
    >
    > Does anyone know for sure? (To be honest, java programs interest me more
    > than applets.)[/color]

    That's definitely not the case. I was referring to different applets running
    in the same browser instance. JVM initialisation also depends on whether or
    not you start it in client or server mode. The latter takes considerbly
    longer to load.


    Comment

    • I V

      Re: On Java and C++

      On Mon, 01 May 2006 21:11:10 +0200, Remon van Vliet wrote:[color=blue]
      > As for resources that are in short supply, i've never actually run into such
      > an issue with Java to begin with and i develop high concurrency servers.[/color]

      Actually, I've never really had a problem with resources being released by
      GC systems either, but I don't develop the sort of applications where I
      would imagine it being a problem. I'd be interested if anyone knows of any
      actual studies which have investigated in precisely what cases
      non-deterministic destruction causes real-world problems. Or, indeed,
      anecdotal experience from those with a wider range of experience than my
      own.
      [color=blue]
      > Reusable resources are usually pooled and cleanly released when
      > necessary, and i cant really think of any other kind of resource that[/color]

      How is the pool notified that a resource is ready to be reused? By a
      finalizer, or by explicitly calling a "release" or "dispose" method? In
      the later case, RAII would be useful in automating the release and helping
      to ensure correctness.

      Comment

      • Noah Roberts

        Re: On Java and C++


        Remon van Vliet wrote:
        [color=blue]
        > I read the entire thread, i understand RAII perfectly.[/color]

        Obviously not as you are demanding that I reiterate the definition yet
        again.

        I already repeated myself enough times in this thread. If you don't
        like the answer that is fine but the answer is here for you to read in
        numerous locations. If you have a question about how something works
        then by all means ask.

        Comment

        • Luc The Perverse

          Re: On Java and C++

          "Remon van Vliet" <remon@exmachin a.nl> wrote in message
          news:44568659$0 $31650$e4fe514c @news.xs4all.nl ...[color=blue]
          >
          > "Luc The Perverse" <sll_noSpamlici ous_z_XXX_m@cc. usu.edu> wrote in message
          > news:798ii3xdnn .ln2@loki.cmear s.id.au...[color=green]
          >> "Remon van Vliet" <remon@exmachin a.nl> wrote in message
          >> news:44565dcd$0 $31644$e4fe514c @news.xs4all.nl ...[color=darkred]
          >>>
          >>> "Luc The Perverse" <sll_noSpamlici ous_z_XXX_m@cc. usu.edu> wrote in
          >>> message news:s61ii3xm0m .ln2@loki.cmear s.id.au...
          >>>> "Remon van Vliet" <remon@exmachin a.nl> wrote in message
          >>>> news:445650da$0 $31651$e4fe514c @news.xs4all.nl ...
          >>>>>
          >>>>> "Chris Smith" <cdsmith@twu.ne t> wrote in message
          >>>>> news:MPG.1ebffc fce1a489db9896a 0@news.astraweb .com...
          >>>>>> Remon van Vliet <remon@exmachin a.nl> wrote:
          >>>>>>> It can be, but with Java2D API you have access to hardware
          >>>>>>> accelerated
          >>>>>>> graphical features that should be on par with Flash performance. In
          >>>>>>> my
          >>>>>>> opinion everything that can be done in Flash can be done in Java.
          >>>>>>> However,
          >>>>>>> Flash is way more efficient from a time to market point of view,
          >>>>>>> it's just a
          >>>>>>> bit easier (and dare i say it better) for web based content.
          >>>>>>
          >>>>>> The problem is not with the performance of the graphics hardware.
          >>>>>> The
          >>>>>> limiting factor is the initialization of the virtual machine.
          >>>>>> Undoubtedly, if things got anywhere near the point of maxing out the
          >>>>>> graphics card, an applet would greatly outperform Flash.
          >>>>>>
          >>>>>
          >>>>> I know, but it's two different things, initialisation isnt in the way
          >>>>> of performance and vice versa. That said, i can see how VM
          >>>>> initialisation is a limiting factor. Having to wait 5+ seconds kind of
          >>>>> shoots applets down as a good option for dynamic web content.
          >>>>
          >>>> I wonder if running the JVM as a process would eliminate this delay, or
          >>>> at least greatly reduce it
          >>>
          >>> I think it sort of is after the first invocation. I cant say for sure
          >>> though.[/color]
          >>
          >> Typically I am opposed to background services running - but if I could
          >> make Java programs initial startup cost go away, I could sacrifice a few
          >> MB.
          >>
          >> Does anyone know for sure? (To be honest, java programs interest me more
          >> than applets.)[/color]
          >
          > That's definitely not the case. I was referring to different applets
          > running in the same browser instance. JVM initialisation also depends on
          > whether or not you start it in client or server mode. The latter takes
          > considerbly longer to load.[/color]

          What advantage does it hold? I plan on writing server applications (albeit
          with an anticipated very low user base)

          --
          LTP

          :)


          Comment

          • Mishagam

            Re: On Java and C++

            Oliver Wong wrote:[color=blue]
            >
            > "Timo Stamm" <timo.stamm@arc or.de> wrote in message
            > news:44563ae1$0 $4493$9b4e6d93@ newsread2.arcor-online.net...[color=green]
            >> Oliver Wong schrieb:[color=darkred]
            >>>
            >>> FWIW, in my experience, Flash is not "much quicker".[/color]
            >>
            >> Thanks for sharing your experience.
            >>
            >> But do you really mean that Flashs /initialization/ is not generally
            >> much faster for you than Applets? Or were you thinking of rendering
            >> and computing performance?
            >>
            >> Right now on my Powerbook with Safari, it takes 11 seconds until the
            >> following very simple applet showed it's input elements:
            >> http://java.sun.com/applets/jdk/1.4/.../example1.html
            >>
            >> The following Flash movie shows instantly, without any measurable delay:
            >> http://www.contourdesign.com/rollerm...ouse_flash.htm[/color]
            >
            >
            > Windows XP with SP2, Pentium 4 1.8Ghz, 1024MB RAM, Firefox 1.5.0.2.
            >
            > Java took 3 seconds, Flash took 5 seconds.
            >
            > - Oliver[/color]
            I agree. Java link was about 2 times faster. Firefox 1.5.0.2.
            IE 6.0 speed was about the same.

            Comment

            • Chris Smith

              Re: On Java and C++

              I V <wrongbad@gmail .com> wrote:[color=blue]
              > Actually, I've never really had a problem with resources being released by
              > GC systems either, but I don't develop the sort of applications where I
              > would imagine it being a problem. I'd be interested if anyone knows of any
              > actual studies which have investigated in precisely what cases
              > non-deterministic destruction causes real-world problems. Or, indeed,
              > anecdotal experience from those with a wider range of experience than my
              > own.[/color]

              If you're asking what I think you are, then I have such anecdotal
              evidence. About a year ago, I fixed a web application that wouldn't
              release a database connection if the user clicked the stop button at a
              certain time. This generally didn't cause any problems, since the JDBC
              spec requires that finalization will close the connection (a very bad
              choice, by the way, which prevented this bug from be discovered in
              testing). The app started failing by running out of database
              connections when it was sold and installed for a very large customer who
              had far more users than were previously seen.

              That was with database connections being released in a timely manner
              most of the time, and only occasionally being left open in certain
              failure cases. I'd hate to see what would've happened if database
              connections were never explicitly closed at all!

              --

              The Easiest Way To Train Anyone... Anywhere.

              Chris Smith - Lead Software Developer/Technical Trainer
              MindIQ Corporation

              Comment

              • ebhakt

                Re: On Java and C++

                It's not of being smarter or not....

                I am both a C/C++ and JAVA coder :

                c is flexible :
                this is both a merit and demerit (depending on programmers
                capabilities)

                Java takes care of this for both lame and stunt performers...

                Its simple for those who want to go that way
                but for big guys JAVA has much more......

                You should not forget that JAVA was the Impetus behind internet ,
                this language should be given respect


                .....
                ........and its programmers are not just smart..they are bigger than
                that

                Bhaskar

                Comment

                • Remon van Vliet

                  Re: On Java and C++


                  "Chris Smith" <cdsmith@twu.ne t> wrote in message
                  news:MPG.1ec095 86176e17199896a 2@news.astraweb .com...[color=blue]
                  >I V <wrongbad@gmail .com> wrote:[color=green]
                  >> Actually, I've never really had a problem with resources being released
                  >> by
                  >> GC systems either, but I don't develop the sort of applications where I
                  >> would imagine it being a problem. I'd be interested if anyone knows of
                  >> any
                  >> actual studies which have investigated in precisely what cases
                  >> non-deterministic destruction causes real-world problems. Or, indeed,
                  >> anecdotal experience from those with a wider range of experience than my
                  >> own.[/color]
                  >
                  > If you're asking what I think you are, then I have such anecdotal
                  > evidence. About a year ago, I fixed a web application that wouldn't
                  > release a database connection if the user clicked the stop button at a
                  > certain time. This generally didn't cause any problems, since the JDBC
                  > spec requires that finalization will close the connection (a very bad
                  > choice, by the way, which prevented this bug from be discovered in
                  > testing). The app started failing by running out of database
                  > connections when it was sold and installed for a very large customer who
                  > had far more users than were previously seen.
                  >
                  > That was with database connections being released in a timely manner
                  > most of the time, and only occasionally being left open in certain
                  > failure cases. I'd hate to see what would've happened if database
                  > connections were never explicitly closed at all![/color]

                  Hehe, okay, in that is Java weakness rather than bad programming? I'm lead
                  developer of high-concurrency servers and i cant begin to count the number
                  of times we use JDBC connections and file access. Not once have we ran into
                  any such issue. Not dealing with all escape paths is simply bad
                  implementation and certainly not a language weakness, Java just makes that
                  quite easy at times with the "finally" block....


                  Comment

                  • Remon van Vliet

                    Re: On Java and C++


                    "Noah Roberts" <roberts.noah@g mail.com> wrote in message
                    news:1146523943 .175096.206630@ v46g2000cwv.goo glegroups.com.. .[color=blue]
                    >
                    > Remon van Vliet wrote:
                    >[color=green]
                    >> I read the entire thread, i understand RAII perfectly.[/color]
                    >
                    > Obviously not as you are demanding that I reiterate the definition yet
                    > again.
                    >
                    > I already repeated myself enough times in this thread. If you don't
                    > like the answer that is fine but the answer is here for you to read in
                    > numerous locations. If you have a question about how something works
                    > then by all means ask.
                    >[/color]

                    Hehe, you're rather selective in your post reading, and you continuously
                    fail to reply to actual posts or the questions mentioned therein. And yes
                    you repeated yourself way too much in this thread, at some point you may
                    want to consider moving to actually come up with valid arguments for your
                    claims. Anyway, i'm going to just let this go and skip over your posts.


                    Comment

                    • Remon van Vliet

                      Re: On Java and C++


                      "Luc The Perverse" <sll_noSpamlici ous_z_XXX_m@cc. usu.edu> wrote in message
                      news:jlmii3xfar .ln2@loki.cmear s.id.au...[color=blue]
                      > "Remon van Vliet" <remon@exmachin a.nl> wrote in message
                      > news:44568659$0 $31650$e4fe514c @news.xs4all.nl ...[color=green]
                      >>
                      >> "Luc The Perverse" <sll_noSpamlici ous_z_XXX_m@cc. usu.edu> wrote in
                      >> message news:798ii3xdnn .ln2@loki.cmear s.id.au...[color=darkred]
                      >>> "Remon van Vliet" <remon@exmachin a.nl> wrote in message
                      >>> news:44565dcd$0 $31644$e4fe514c @news.xs4all.nl ...
                      >>>>
                      >>>> "Luc The Perverse" <sll_noSpamlici ous_z_XXX_m@cc. usu.edu> wrote in
                      >>>> message news:s61ii3xm0m .ln2@loki.cmear s.id.au...
                      >>>>> "Remon van Vliet" <remon@exmachin a.nl> wrote in message
                      >>>>> news:445650da$0 $31651$e4fe514c @news.xs4all.nl ...
                      >>>>>>
                      >>>>>> "Chris Smith" <cdsmith@twu.ne t> wrote in message
                      >>>>>> news:MPG.1ebffc fce1a489db9896a 0@news.astraweb .com...
                      >>>>>>> Remon van Vliet <remon@exmachin a.nl> wrote:
                      >>>>>>>> It can be, but with Java2D API you have access to hardware
                      >>>>>>>> accelerated
                      >>>>>>>> graphical features that should be on par with Flash performance. In
                      >>>>>>>> my
                      >>>>>>>> opinion everything that can be done in Flash can be done in Java.
                      >>>>>>>> However,
                      >>>>>>>> Flash is way more efficient from a time to market point of view,
                      >>>>>>>> it's just a
                      >>>>>>>> bit easier (and dare i say it better) for web based content.
                      >>>>>>>
                      >>>>>>> The problem is not with the performance of the graphics hardware.
                      >>>>>>> The
                      >>>>>>> limiting factor is the initialization of the virtual machine.
                      >>>>>>> Undoubtedly, if things got anywhere near the point of maxing out the
                      >>>>>>> graphics card, an applet would greatly outperform Flash.
                      >>>>>>>
                      >>>>>>
                      >>>>>> I know, but it's two different things, initialisation isnt in the way
                      >>>>>> of performance and vice versa. That said, i can see how VM
                      >>>>>> initialisation is a limiting factor. Having to wait 5+ seconds kind
                      >>>>>> of shoots applets down as a good option for dynamic web content.
                      >>>>>
                      >>>>> I wonder if running the JVM as a process would eliminate this delay,
                      >>>>> or at least greatly reduce it
                      >>>>
                      >>>> I think it sort of is after the first invocation. I cant say for sure
                      >>>> though.
                      >>>
                      >>> Typically I am opposed to background services running - but if I could
                      >>> make Java programs initial startup cost go away, I could sacrifice a few
                      >>> MB.
                      >>>
                      >>> Does anyone know for sure? (To be honest, java programs interest me
                      >>> more than applets.)[/color]
                      >>
                      >> That's definitely not the case. I was referring to different applets
                      >> running in the same browser instance. JVM initialisation also depends on
                      >> whether or not you start it in client or server mode. The latter takes
                      >> considerbly longer to load.[/color]
                      >
                      > What advantage does it hold? I plan on writing server applications
                      > (albeit with an anticipated very low user base)
                      >
                      > --
                      > LTP
                      >
                      > :)
                      >[/color]

                      In server mode the VM is way more aggressive when it comes to inlining code
                      and other things. In short it uses a bit more memory and a lot of
                      initialisation time to speed up your applications. Make no mistake, in a lot
                      of cases there's a very noticeable speed difference. I once made a real-time
                      raytracer in Java just for fun and it doubled speed in the server VM, and
                      all it really does is some vector math. Server VM can be enabled with SDK
                      VMs (rather than JRE) and using the -server command line parameter. I
                      suggest you write a small CPU intensive program and check out the
                      difference. Hope this helps.

                      Remon


                      Comment

                      • Chris Uppal

                        Re: On Java and C++

                        Oliver Wong wrote:
                        [color=blue]
                        > Windows XP with SP2, Pentium 4 1.8Ghz, 1024MB RAM, Firefox 1.5.0.2.
                        >
                        > Java took 3 seconds, Flash took 5 seconds.[/color]

                        That sounds wrong to me. Did your browser already have a JVM started (as is
                        likely if -- for example -- you'd visited Roedy's site since you last killed
                        all your Firefox windows) ?

                        FWIW, Flash is instant on my WinXP + Firefox settup -- I won't have Flash
                        installed so it fails without noticeable delay ;-)

                        -- chris


                        Comment

                        • Otis Bricker

                          Re: On Java and C++

                          "Remon van Vliet" <remon@exmachin a.nl> wrote in
                          news:44572bc7$0 $31638$e4fe514c @news.xs4all.nl :
                          [color=blue]
                          >
                          > "Chris Smith" <cdsmith@twu.ne t> wrote in message
                          > news:MPG.1ec095 86176e17199896a 2@news.astraweb .com...[color=green]
                          >>I V <wrongbad@gmail .com> wrote:[color=darkred]
                          >>> Actually, I've never really had a problem with resources being
                          >>> released by
                          >>> GC systems either, but I don't develop the sort of applications
                          >>> where I would imagine it being a problem. I'd be interested if
                          >>> anyone knows of any
                          >>> actual studies which have investigated in precisely what cases
                          >>> non-deterministic destruction causes real-world problems. Or,
                          >>> indeed, anecdotal experience from those with a wider range of
                          >>> experience than my own.[/color]
                          >>
                          >> If you're asking what I think you are, then I have such anecdotal
                          >> evidence. About a year ago, I fixed a web application that wouldn't
                          >> release a database connection if the user clicked the stop button at
                          >> a certain time. This generally didn't cause any problems, since the
                          >> JDBC spec requires that finalization will close the connection (a
                          >> very bad choice, by the way, which prevented this bug from be
                          >> discovered in testing). The app started failing by running out of
                          >> database connections when it was sold and installed for a very large
                          >> customer who had far more users than were previously seen.
                          >>
                          >> That was with database connections being released in a timely manner
                          >> most of the time, and only occasionally being left open in certain
                          >> failure cases. I'd hate to see what would've happened if database
                          >> connections were never explicitly closed at all![/color]
                          >
                          > Hehe, okay, in that is Java weakness rather than bad programming? I'm
                          > lead developer of high-concurrency servers and i cant begin to count
                          > the number of times we use JDBC connections and file access. Not once
                          > have we ran into any such issue. Not dealing with all escape paths is
                          > simply bad implementation and certainly not a language weakness, Java
                          > just makes that quite easy at times with the "finally" block....
                          >[/color]

                          While what you say IS true, you should handle all escape paths, I do have
                          to agree that RAII(or should we focus on the other end, RDIF Resource
                          Diallocation is Finalization) often makes it easier to handle all escape
                          paths. It is common in C++ to create a class on the stack that
                          locks/unlocks/opens a resource during construction and returns it to its
                          original state in its destructor. Having done so you can forget about it.
                          No need to deal with it at all when the method using it exits. Even
                          during exceptions. You know the destructor will have been called once you
                          are out and all will be as it was.

                          When I work with Java I often miss the ease deterministic destructors
                          provide. And I also sometimes miss 'finally' and anonymous classes when
                          programming in C++.

                          RAII is a tool. You don't need it but it does make things a lot easier
                          when its can be used.

                          Otis

                          Comment

                          • Alex Hunsley

                            Re: On Java and C++

                            ebhakt wrote:[color=blue]
                            > It's not of being smarter or not....
                            >
                            > I am both a C/C++ and JAVA coder :
                            >
                            > c is flexible :
                            > this is both a merit and demerit (depending on programmers
                            > capabilities)
                            >
                            > Java takes care of this for both lame and stunt performers...
                            >
                            > Its simple for those who want to go that way
                            > but for big guys JAVA has much more......
                            >
                            > You should not forget that JAVA was the Impetus behind internet ,
                            > this language should be given respect[/color]

                            No, the american military and the threat of nuclear war was the impetus
                            behind the internet, which started coming into being at the tail of of
                            the 60s. Java didn't exist until the 90's.

                            Comment

                            • Timo Stamm

                              Re: On Java and C++

                              Remon van Vliet schrieb:[color=blue]
                              > "Chris Smith" wrote:[color=green]
                              >> That was with database connections being released in a timely manner
                              >> most of the time, and only occasionally being left open in certain
                              >> failure cases. I'd hate to see what would've happened if database
                              >> connections were never explicitly closed at all![/color]
                              >
                              > Hehe, okay, in that is Java weakness rather than bad programming? I'm lead
                              > developer of high-concurrency servers and i cant begin to count the number
                              > of times we use JDBC connections and file access. Not once have we ran into
                              > any such issue.[/color]

                              The same argument could be used for unmanaged memory allocation. In that
                              sense, memory leaks are the result of bad programming, not a weakness of
                              the language.


                              Timo

                              Comment

                              • Noah Roberts

                                Re: On Java and C++


                                Otis Bricker wrote:
                                [color=blue]
                                > RAII is a tool. You don't need it but it does make things a lot easier
                                > when its can be used.[/color]

                                There it is.

                                Comment

                                Working...