Thread: srand slows down my program to a crawl

  1. #31
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,787
    Quote Originally Posted by jeremy duncan View Post
    I'm using the gui.

    Windows 7 64 bit.

    I'm using the desktop gui right now. I can update the master pretty good, but that's about it. I will watch some more youtube videos later.
    Good stuff. Stick with it... the learning curve is not as terrible as you may think it is at the moment, and the benefits or learning this far outweigh the costs (of time spent learning). Version control is as much a part of modern programming as programming languages.

  2. #32
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by jeremy duncan
    Then I coded all day and night and cleaned up the code and fixed a ton of logical errors then I had about 11 commits to the project, so I deleted the repository and uploaded the new code to start over.
    I admit that sometimes I am ashamed of my mistakes and would like to leave them out of the history, but it is actually quite irrational: in the end what matters is that you found the bugs and fixed them, not that you had old commits that had the bugs.

    That said, with feature branches, it is possible to do a squashed merge of the feature branch to master such that it looks like you wrote that feature in a single magically almost perfect commit. As Hodor noted, you can do this even without feature branches, but I feel that there is a risk that you may get careless and rewrite history that has already been pushed to the origin server, thus causing problems for fellow developers when working in a team.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #33
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,787
    Quote Originally Posted by laserlight View Post
    <snip> rewrite history that has already been pushed to the origin server, thus causing problems for fellow developers when working in a team.
    Yes, rewriting history is bad (and infuriating when you have more than one person involved). But it you rewrite history you would have to -f the commit. If your (private) branch has not yet been pushed I see nothing wrong with squashing commits in some cases. BUT, as laserlight pointed out, in many cases it's not desirable. Yeah, there might be 11 commits instead of 1 but so what? Having a history of changes is kinda the point and if there are 11 small changes (commits) instead of 1 squashed commit and some bug shows up in the future then there are ways to narrow down the exact change that caused the bug (bisecting the problem). If there are a huge amount of changes in a single commit then the usefulness of this debugging feature (finding where the bug was introduced) becomes a lot less useful.

  4. #34
    Registered User
    Join Date
    Apr 2011
    Posts
    308
    Thanks everyone for your help. Merry Christmas.

  5. #35
    Registered User
    Join Date
    Oct 2014
    Location
    Australia
    Posts
    5
    You may never be shown refactoring in a beginner's book. There are some for other audiences, but even if you never read it in a book, being able to refactor is a valued skill. It comes down to producing something professional.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Recursion slows down mysteriously
    By brane_sail in forum C++ Programming
    Replies: 9
    Last Post: 03-20-2008, 07:03 AM
  2. My script slows down how do I fix this??
    By JordanCason in forum C++ Programming
    Replies: 10
    Last Post: 11-25-2007, 11:43 PM
  3. What slows down if statements?
    By Hunter2 in forum C++ Programming
    Replies: 3
    Last Post: 05-30-2003, 03:37 PM
  4. directory and file crawl
    By atari400 in forum C++ Programming
    Replies: 4
    Last Post: 04-24-2003, 05:04 PM
  5. Program slows down system
    By Mox in forum Windows Programming
    Replies: 1
    Last Post: 10-23-2001, 08:11 AM

Tags for this Thread