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. <60 seconds

<60 seconds

Scheduled Pinned Locked Moved The Lounge
csharpcssvisual-studiocomalgorithms
17 Posts 11 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 Marc Clifton

    David Stone wrote: When can we expect the article, Marc? I'm writing it this weekend. :-D David Stone wrote: Seriously though...under a minute? On what hardware? A 2.8Ghz P4 with Hyperthreading. My previous best time was around 30 minutes. Imagine my shock when the algorithm change I made resulted in this difference. I figured it would be an improvement, but not THAT significant! So, regardless of the machine performance, going from 30 minutes to about 40 seconds (turning off GUI updates) is pretty amazing. Marc MyXaml Advanced Unit Testing YAPO

    C Offline
    C Offline
    Christian Graus
    wrote on last edited by
    #7

    Yeah, I always recall a similar story in a C++ book I read, where a guy spent ages optimising code, to get a small improvement, then he rethought the algorithm and without optimisations, blew the old code out of the water. Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer

    J 1 Reply Last reply
    0
    • M Marc Clifton

      I've come up with an algorithm that determines the 26656 solutions in less than 60 seconds for this.[^] It's really quite a fun problem to work on in one's spare time. Any more takers? It'd be neat to get some other contributors. I'm not in it for the VB vs. C# thing, I just love these kind of problems. Marc MyXaml Advanced Unit Testing YAPO

      Z Offline
      Z Offline
      zarzor
      wrote on last edited by
      #8

      Are you still alive Marc? ;) ZARZOR13

      M 1 Reply Last reply
      0
      • D David Stone

        going from 30 minutes to about 40 seconds (turning off GUI updates) is pretty amazing. Oh yeah, definitely. Synchronous GUI updates in a tight algorithm are a bad idea, IMO. Painting takes so freaking long compared to the mathematical analysis that is involved in an algorithm that it bogs down considerably. I noticed that in the original sample. When I had it updating the GUI it was running dog slow. I ripped out the GUI update code and it ran a whole heck of a lot faster. But not enough to complete in 40 seconds. I'm looking forward to seeing how you did it. :)


        [Cheshire] I can't afford those plastic things to cover the electric sockets so I just draw bunny faces on the electric outlets to scare the kids away from them... [RLtim] Newsflash! Kids aren't afraid of bunnies. [Cheshire] Oh they will be... -Bash.org

        R Offline
        R Offline
        Ryan Roberts
        wrote on last edited by
        #9

        Output heavy console applications can be a pig on laptop hardware too. Quite amusing resizing a console window and speeding up an app by at least 300%. Ryan.

        D 1 Reply Last reply
        0
        • Z zarzor

          Are you still alive Marc? ;) ZARZOR13

          M Offline
          M Offline
          Marc Clifton
          wrote on last edited by
          #10

          zarzor wrote: Are you still alive Marc? No, I am speaking to you from the spiritual world! woooo oooooo boo! :-D Marc MyXaml Advanced Unit Testing YAPO

          M 1 Reply Last reply
          0
          • M Marc Clifton

            I've come up with an algorithm that determines the 26656 solutions in less than 60 seconds for this.[^] It's really quite a fun problem to work on in one's spare time. Any more takers? It'd be neat to get some other contributors. I'm not in it for the VB vs. C# thing, I just love these kind of problems. Marc MyXaml Advanced Unit Testing YAPO

            J Offline
            J Offline
            Jeremy Falcon
            wrote on last edited by
            #11

            Oh come on, how can you talk an article seriously that says this... "Perhaps it is to compensate the fact that C# are probably not as good a VB programmers are." :) Jeremy Falcon

            M 1 Reply Last reply
            0
            • J Jeremy Falcon

              Oh come on, how can you talk an article seriously that says this... "Perhaps it is to compensate the fact that C# are probably not as good a VB programmers are." :) Jeremy Falcon

              M Offline
              M Offline
              Marc Clifton
              wrote on last edited by
              #12

              Jeremy Falcon wrote: Oh come on, how can you talk an article seriously that says this... Still, I decided that it would be fun project on the merits of the exercise, not the underlying motivations. Then again, if I can blow the pants of any VB implementation, who am I to complain? :~ (I better not screw up, eh?) Marc MyXaml Advanced Unit Testing YAPO

              J 1 Reply Last reply
              0
              • M Marc Clifton

                Jeremy Falcon wrote: Oh come on, how can you talk an article seriously that says this... Still, I decided that it would be fun project on the merits of the exercise, not the underlying motivations. Then again, if I can blow the pants of any VB implementation, who am I to complain? :~ (I better not screw up, eh?) Marc MyXaml Advanced Unit Testing YAPO

                J Offline
                J Offline
                Jeremy Falcon
                wrote on last edited by
                #13

                Marc Clifton wrote: Then again, if I can blow the pants of any VB implementation, who am I to complain? That's the spirit! I'm looking forward to the article. :) Jeremy Falcon

                1 Reply Last reply
                0
                • M Marc Clifton

                  I've come up with an algorithm that determines the 26656 solutions in less than 60 seconds for this.[^] It's really quite a fun problem to work on in one's spare time. Any more takers? It'd be neat to get some other contributors. I'm not in it for the VB vs. C# thing, I just love these kind of problems. Marc MyXaml Advanced Unit Testing YAPO

                  C Offline
                  C Offline
                  ColinDavies
                  wrote on last edited by
                  #14

                  So you obviously have a good new algorithm at work. The guts to me is the less brute force that you rely on the better. Imagine if you could rather calculate the positions than search for them. Regardz Colin J Davies The most LinkedIn CPian (that I know of anyhow) :-)

                  1 Reply Last reply
                  0
                  • M Marc Clifton

                    zarzor wrote: Are you still alive Marc? No, I am speaking to you from the spiritual world! woooo oooooo boo! :-D Marc MyXaml Advanced Unit Testing YAPO

                    M Offline
                    M Offline
                    Mathew Hall
                    wrote on last edited by
                    #15

                    No, I am speaking to you from the spiritual world! woooo oooooo boo! Or as Zaphod would say "No - I just haven't stopped moving yet" :-D "I think I speak on behalf of everyone here when I say huh?" - Buffy

                    1 Reply Last reply
                    0
                    • R Ryan Roberts

                      Output heavy console applications can be a pig on laptop hardware too. Quite amusing resizing a console window and speeding up an app by at least 300%. Ryan.

                      D Offline
                      D Offline
                      Daniel Turini
                      wrote on last edited by
                      #16

                      Ryan Roberts wrote: Output heavy console applications can be a pig on laptop hardware too. Quite amusing resizing a console window and speeding up an app by at least 300%. Next time, press Alt-Enter and enter full screen mode. This will put you at text mode, instead of Graphics mode. The video hardware is much faster at drawing chars and scrolling areas than Windows, because you'll be now at text mode. I see dead pixels Yes, even I am blogging now!

                      1 Reply Last reply
                      0
                      • C Christian Graus

                        Yeah, I always recall a similar story in a C++ book I read, where a guy spent ages optimising code, to get a small improvement, then he rethought the algorithm and without optimisations, blew the old code out of the water. Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer

                        J Offline
                        J Offline
                        Johan Rosengren
                        wrote on last edited by
                        #17

                        Christian Graus wrote: Yeah, I always recall a similar story in a C++ book I read, where a guy spent ages optimising code, to get a small improvement, then he rethought the algorithm and without optimisations, blew the old code out of the water. I've done exactly this myself. Worked on a project with a C++ server application taking in excess of 26 hours for a single run - which was a tad too much as the application had to run once a day (yes, it processed an awful lot of data). By applying all kinds of tricks - a few of them rendering parts of the code almost impossible to maintain for future developers, I might add, I shaved away 2 hours of the running time. Hm, not good enough. Time to rethink - I started from scratch, and instead of trying to optimize the existing application, I though about what the application was expected to do instead - not thinking of how to solve details. Redoing the complete structure from scratch, completely changing the process, I was of course very exited when it came to the first test run... 20 minutes. The rewrite took a fraction of the time I had spent on optimization.

                        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