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. Do you know what's also slow?

Do you know what's also slow?

Scheduled Pinned Locked Moved The Lounge
csharpcomtestingbeta-testingquestion
8 Posts 4 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.
  • M Offline
    M Offline
    martin_hughes
    wrote on last edited by
    #1

    Attempting to greyscale 500 odd (~2329x3500 24bpp) images using IronPython. And I mean sloooooooooooooooooooooooooooooooooow! The sort of sloooooooooooooooooooow that doesn't just necessitate the making of a brew, but also requires you to go out for a very long walk, read the paper, have a nice long nap, have dinner, enjoy some beer in the garden, go to bed feeling a bit drunk and wake up the next morning hoping the process has finished. Of course, I'm not stupid so I did some testing first :) With a single thread each image was taking > 1 minute to process. I managed to improve that a little bit by using some multi-threading savvy and got it down to, a still highly unsatisfactory, 38 seconds. At which point I decided I'd try it in C# instead. The code is pretty much exactly the same as the IronPython implementation, the results somewhat startling. On the same machine, using the same .Net features, a single threaded C# app was able to process each image in .78 seconds (using my rudimentary timing technique). So there you go, chums, IronPython may be quite cool - I like it! - but if you're into doing anything with images I'd probably consider using something else.

    Books written by CP members

    CPalliniC A S 3 Replies Last reply
    0
    • M martin_hughes

      Attempting to greyscale 500 odd (~2329x3500 24bpp) images using IronPython. And I mean sloooooooooooooooooooooooooooooooooow! The sort of sloooooooooooooooooooow that doesn't just necessitate the making of a brew, but also requires you to go out for a very long walk, read the paper, have a nice long nap, have dinner, enjoy some beer in the garden, go to bed feeling a bit drunk and wake up the next morning hoping the process has finished. Of course, I'm not stupid so I did some testing first :) With a single thread each image was taking > 1 minute to process. I managed to improve that a little bit by using some multi-threading savvy and got it down to, a still highly unsatisfactory, 38 seconds. At which point I decided I'd try it in C# instead. The code is pretty much exactly the same as the IronPython implementation, the results somewhat startling. On the same machine, using the same .Net features, a single threaded C# app was able to process each image in .78 seconds (using my rudimentary timing technique). So there you go, chums, IronPython may be quite cool - I like it! - but if you're into doing anything with images I'd probably consider using something else.

      Books written by CP members

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      martin_hughes wrote:

      that doesn't just necessitate the making of a brew, but also requires you to go out for a very long walk, read the paper, have a nice long nap, have dinner, enjoy some beer in the garden, go to bed feeling a bit drunk and wake up the next morning

      martin_hughes wrote:

      Of course, I'm not stupid

      I see no coherence there. :rolleyes:

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      In testa che avete, signor di Ceprano?

      M 1 Reply Last reply
      0
      • CPalliniC CPallini

        martin_hughes wrote:

        that doesn't just necessitate the making of a brew, but also requires you to go out for a very long walk, read the paper, have a nice long nap, have dinner, enjoy some beer in the garden, go to bed feeling a bit drunk and wake up the next morning

        martin_hughes wrote:

        Of course, I'm not stupid

        I see no coherence there. :rolleyes:

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        M Offline
        M Offline
        martin_hughes
        wrote on last edited by
        #3

        Meh... I can do:

        martin_hughes wrote:

        necessitate the making of a brew, but also requires you to go out for a very long walk, read the paper, have a nice long nap, have dinner, enjoy some beer in the garden, go to bed feeling a bit drunk and wake up the next morning

        whenever I want :)

        Books written by CP members

        1 Reply Last reply
        0
        • M martin_hughes

          Attempting to greyscale 500 odd (~2329x3500 24bpp) images using IronPython. And I mean sloooooooooooooooooooooooooooooooooow! The sort of sloooooooooooooooooooow that doesn't just necessitate the making of a brew, but also requires you to go out for a very long walk, read the paper, have a nice long nap, have dinner, enjoy some beer in the garden, go to bed feeling a bit drunk and wake up the next morning hoping the process has finished. Of course, I'm not stupid so I did some testing first :) With a single thread each image was taking > 1 minute to process. I managed to improve that a little bit by using some multi-threading savvy and got it down to, a still highly unsatisfactory, 38 seconds. At which point I decided I'd try it in C# instead. The code is pretty much exactly the same as the IronPython implementation, the results somewhat startling. On the same machine, using the same .Net features, a single threaded C# app was able to process each image in .78 seconds (using my rudimentary timing technique). So there you go, chums, IronPython may be quite cool - I like it! - but if you're into doing anything with images I'd probably consider using something else.

          Books written by CP members

          A Offline
          A Offline
          AspDotNetDev
          wrote on last edited by
          #4

          I doubt that is a problem with the language. Seems like maybe you're using it wrong and decreasing the big-O performance (say, from N to N^2). I could be wrong, but what exactly about the language itself are you expecting is slowing the process down so much (note: I have never used that language, so maybe you are right)?

          [Forum Guidelines]

          M 1 Reply Last reply
          0
          • A AspDotNetDev

            I doubt that is a problem with the language. Seems like maybe you're using it wrong and decreasing the big-O performance (say, from N to N^2). I could be wrong, but what exactly about the language itself are you expecting is slowing the process down so much (note: I have never used that language, so maybe you are right)?

            [Forum Guidelines]

            M Offline
            M Offline
            martin_hughes
            wrote on last edited by
            #5

            There might be more "Python friendly" ways of doing things, but I don't think there's anything intrinsically wrong with my implementation. Line for line, it's almost exactly the same as the C# version (syntactic differences notwithstanding). Where IronPython seems to hit a bottleneck, in this instance at any rate, is indexing into .Net typed arrays. My guess is the hit comes from all the fancy things IPY does to ensure that whilst it can do all the duck typing and dynamic stuff it can ensure that what it's dealing with is correct at runtime. C# doesn't have that problem having being assured of it all at compile time. Give it a whirl for yourself; Python is quite a nice and friendly language and useful for a lot of things and well worth knowing something about - IronPython doubly so. I'd recommend Guido van Rossum's An Introduction to Python also: not only a useful Python introduction, but also a model of a language introductory book.

            Books written by CP members

            1 Reply Last reply
            0
            • M martin_hughes

              Attempting to greyscale 500 odd (~2329x3500 24bpp) images using IronPython. And I mean sloooooooooooooooooooooooooooooooooow! The sort of sloooooooooooooooooooow that doesn't just necessitate the making of a brew, but also requires you to go out for a very long walk, read the paper, have a nice long nap, have dinner, enjoy some beer in the garden, go to bed feeling a bit drunk and wake up the next morning hoping the process has finished. Of course, I'm not stupid so I did some testing first :) With a single thread each image was taking > 1 minute to process. I managed to improve that a little bit by using some multi-threading savvy and got it down to, a still highly unsatisfactory, 38 seconds. At which point I decided I'd try it in C# instead. The code is pretty much exactly the same as the IronPython implementation, the results somewhat startling. On the same machine, using the same .Net features, a single threaded C# app was able to process each image in .78 seconds (using my rudimentary timing technique). So there you go, chums, IronPython may be quite cool - I like it! - but if you're into doing anything with images I'd probably consider using something else.

              Books written by CP members

              S Offline
              S Offline
              S Senthil Kumar
              wrote on last edited by
              #6

              What version of IronPython were you running? The latest one running on .NET 4?

              Regards Senthil _____________________________ My Home Page |My Blog | My Articles | My Flickr | WinMacro

              M 1 Reply Last reply
              0
              • S S Senthil Kumar

                What version of IronPython were you running? The latest one running on .NET 4?

                Regards Senthil _____________________________ My Home Page |My Blog | My Articles | My Flickr | WinMacro

                M Offline
                M Offline
                martin_hughes
                wrote on last edited by
                #7

                It's version 2.6.10920.0 on .Net 3.5 SP1.

                Books written by CP members

                S 1 Reply Last reply
                0
                • M martin_hughes

                  It's version 2.6.10920.0 on .Net 3.5 SP1.

                  Books written by CP members

                  S Offline
                  S Offline
                  S Senthil Kumar
                  wrote on last edited by
                  #8

                  I wonder if the version running on .NET 4 will be faster - with the DLR and all that.

                  Regards Senthil _____________________________ My Home Page |My Blog | My Articles | My Flickr | WinMacro

                  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