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. C# or Java ??

C# or Java ??

Scheduled Pinned Locked Moved The Lounge
csharpjavaquestion
73 Posts 41 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.
  • R rockNroll

    Hi, I have got a new project which is based on image processing. Which language will be better for this project.. C# or Java and why ? cheers rNr

    Y Offline
    Y Offline
    yassir hannoun
    wrote on last edited by
    #62

    between the two C# but for image processing u should consider C++

    1 Reply Last reply
    0
    • J jsd001002

      C#,It is faster

      J Offline
      J Offline
      JasonCordes
      wrote on last edited by
      #63

      jsd001002 wrote:

      C#,It is faster

      would you mind providing empirical evidence to that extent? Having developed two 3D platforms in Java, I'm not convinced of all this slowness that people purport Java to have. Specifically, can you demonstrate what areas C# is faster in?

      F 1 Reply Last reply
      0
      • R rockNroll

        Hi, I have got a new project which is based on image processing. Which language will be better for this project.. C# or Java and why ? cheers rNr

        J Offline
        J Offline
        JasonCordes
        wrote on last edited by
        #64

        As noted, the best language is likely the one you are most familiar with. Some notes, Java comes with the JAI which is a library specifically designed for Image processing. There is also a very good Java Image Processing book. Unfortunately the book was released before the JAI library so does not take advantage of it. The book is, regardless, quite good. C# has image processing libraries available from third parties. As noted in this thread, if you want a GUI interface on top, Visual Studio provides a handy WYSIWYG GUI editor. I prefer hand coding these things, so Java works better for me there. C++ has many good third party image processing libraries available. As far as speed, I think you'll find Java comparable to C++ in most respects, and good benchmarking tests and tools will make this clearly evident. The one thing I would point out, though, is that Java has a very poor implementation for their trig library and it is VERY slow. This is the only thing that would give me pause to use Java for image processing.

        1 Reply Last reply
        0
        • L Lost User

          Never tried Fortran. But did use PLAN on an ICL 1900 series, as well as COBOL and Assembler on an IBM 360. Those were the days when timeshare was common and input via a punched card/tape after agency punching them from 80 column hand written coding sheets.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #65

          Richard A. Abbott wrote:

          did use PLAN on an ICL 1900 series, as well as COBOL and Assembler on an IBM 360.

          Snap! Avoided COBOL fairly successfully for 13 years from 1963 on, and then became more of an analyst/designer.

          Bob Emmett

          1 Reply Last reply
          0
          • R rockNroll

            Hi, I have got a new project which is based on image processing. Which language will be better for this project.. C# or Java and why ? cheers rNr

            E Offline
            E Offline
            etkid84
            wrote on last edited by
            #66

            enough of the ms dependency it's a java wannabe anyway

            David

            1 Reply Last reply
            0
            • J JasonCordes

              jsd001002 wrote:

              C#,It is faster

              would you mind providing empirical evidence to that extent? Having developed two 3D platforms in Java, I'm not convinced of all this slowness that people purport Java to have. Specifically, can you demonstrate what areas C# is faster in?

              F Offline
              F Offline
              Fabio Franco
              wrote on last edited by
              #67

              He is probably just bloating the forum. I'd say that C# and Java perform very closely with some specific parts one is fast than the other, but nothing really significant. What is the fact is that both of them are outperformed by C++ and other unmanaged languages. Managed languages have many advantages, but some of them comes at the cost of performance like automatic garbage collection. I might be wrong but if I were to choose a language only for performance reasons I would have a hard time trying to decide on C# or JAVA. Maybe I would just flip coins.

              1 Reply Last reply
              0
              • M MidwestLimey

                Image processing - how intense? If very: C++ If not: C#, but then I'm biased towards good languages.


                I'm largely language agnostic


                After a while they all bug me :doh:


                A Offline
                A Offline
                azonenberg
                wrote on last edited by
                #68

                Well, for REALLY intense image processing you will want to use assembly language. One time I wrote a raytracer for calculating the signal strength of an 802.11 network. In C++ it took around 700ms to refresh the screen with one access point. (1000x800 pixel map, 2.2 GHz dual core cpu, single-threaded renderer). Making the renderer threaded dropped the render time to around 500ms - but rewriting the inner loop in assembly language (only 19 instructions) doubled the speed to 250 ms.

                1 Reply Last reply
                0
                • R reshi999

                  Ouch...just ouch... :-)

                  A Offline
                  A Offline
                  azonenberg
                  wrote on last edited by
                  #69

                  I'm sure he doesn't mean write EVERYTHING in assembly. I write almost all of my code in native C++, and for really speed-critical stuff I use asm optimizations. An RF raytracer I wrote last week experienced a perceptible speed improvement just by changing a few sqrt calls to assembly. Consider the statement dist=sqrt(dsq); The code generated by this is nearly 60 instructions long: (simplified for display)

                  fld dsq
                  call sqrt
                  fstp dist

                  ;Everything below this is in msvcrt.dll
                  sqrt:
                  ; save stack frame and registers - about 8 instructions
                  call _sqrtf
                  ; restore stack frame and registers - about 8 instructions
                  ret

                  _sqrtf:
                  ; save stack frame and registers - about 8 instructions
                  call _sqrt
                  ; restore stack frame and registers - about 8 instructions
                  ret

                  _sqrt:
                  ; save stack frame and registers - about 8 instructions
                  fsqrt
                  ; restore stack frame and registers - about 8 instructions
                  ret

                  The same exact result can be obtained by using three inline assembly instructions:

                  fld dsq
                  fsqrt
                  fstp dist

                  This is TWENTY TIMES LESS CODE than the high-level version! This is admittedly an extreme example, but it was taken directly from code I wrote last week, in an inner loop executing about 5x10^7 times per update.

                  modified on Tuesday, May 20, 2008 2:35 PM

                  R 1 Reply Last reply
                  0
                  • R rockNroll

                    Hi, I have got a new project which is based on image processing. Which language will be better for this project.. C# or Java and why ? cheers rNr

                    P Offline
                    P Offline
                    Plamen Dragiyski
                    wrote on last edited by
                    #70

                    I suppose you'll done some binary conversation of an image. If you look for faster code, then write it in C# or C/C++ better (Or asm if you need critical fast code). If you look for easier code - write it to the language you know better. If you want just file conversation (but not displaying the image) I suggest you PHP.

                    1 Reply Last reply
                    0
                    • A azonenberg

                      I'm sure he doesn't mean write EVERYTHING in assembly. I write almost all of my code in native C++, and for really speed-critical stuff I use asm optimizations. An RF raytracer I wrote last week experienced a perceptible speed improvement just by changing a few sqrt calls to assembly. Consider the statement dist=sqrt(dsq); The code generated by this is nearly 60 instructions long: (simplified for display)

                      fld dsq
                      call sqrt
                      fstp dist

                      ;Everything below this is in msvcrt.dll
                      sqrt:
                      ; save stack frame and registers - about 8 instructions
                      call _sqrtf
                      ; restore stack frame and registers - about 8 instructions
                      ret

                      _sqrtf:
                      ; save stack frame and registers - about 8 instructions
                      call _sqrt
                      ; restore stack frame and registers - about 8 instructions
                      ret

                      _sqrt:
                      ; save stack frame and registers - about 8 instructions
                      fsqrt
                      ; restore stack frame and registers - about 8 instructions
                      ret

                      The same exact result can be obtained by using three inline assembly instructions:

                      fld dsq
                      fsqrt
                      fstp dist

                      This is TWENTY TIMES LESS CODE than the high-level version! This is admittedly an extreme example, but it was taken directly from code I wrote last week, in an inner loop executing about 5x10^7 times per update.

                      modified on Tuesday, May 20, 2008 2:35 PM

                      R Offline
                      R Offline
                      reshi999
                      wrote on last edited by
                      #71

                      Cool, congrats on that as optimisation of code is never bad in my book ;-) Seeing the original reply just reminded me of the nightmare of my university days - One teacher insisted everything be done in assembler stacks.

                      1 Reply Last reply
                      0
                      • R reshi999

                        Funny you should ask as I have been developing image processor routines in C# for the past 2 weeks for OCR apps. Image manipulation is fairly easy once you are able to pull images into the correct binary classes, then I have been able to apply image transitions quite easily on a bit by bit level. Its not as fast as I would like but I have not optimised the code at all, it takes about 3 seconds to apply a brighten & sharpen filter on a 247k grayscale tiff. I am limited by the choice of language here though and have no idea on how fast java would perform.

                        R Offline
                        R Offline
                        reshi999
                        wrote on last edited by
                        #72

                        Later correction - have optimised the image processing down to 0.2 seconds. If you choose the C# method check out the folllowing codeproject app : http://www.codeproject.com/KB/GDI-plus/edge_detection.aspx?display=Print[^]

                        1 Reply Last reply
                        0
                        • R rockNroll

                          Hi, I have got a new project which is based on image processing. Which language will be better for this project.. C# or Java and why ? cheers rNr

                          P Offline
                          P Offline
                          Paul Watson
                          wrote on last edited by
                          #73

                          Java because it will hurt those who follow you more.

                          regards, Paul Watson Ireland & South Africa

                          Fernando A. Gomez F. wrote:

                          At least he achieved immortality for a few years.

                          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