Results 1 to 7 of 7

Thread: how optimizate the programming?

  1. #1

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,923

    how optimizate the programming?

    i don't choose any programming language, because these question is for all programming languages...
    everyone can create their own algorithm, but some can be slow and others can be faster...
    ok... if we use Graphics libraries, they can be much faster than CPU functions.... but forgetting these, what is the best steps for we create a much more faster algorithm?
    seems a basic question, but i didn't learned about optimization code on school... all most everything that i learned was by me(ebooks and forums)
    VB6 2D Sprite control

    To live is difficult, but we do it.

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: how optimizate the programming?

    To start, by reading about existing algos from books/articles which are language agnostic. From there, depending on what it is you're trying to do, you tinker by implementing one of those algos and then push things around. But also understand that some of these have been around for decades, have already been optimized, and sometimes depending on the number or nature of things, some things will only be faster than others in certain situations. Sort is a classic example of this. There's really only so many ways that it can be done, and it's been something that's been refined over time, and so it's probably as good as it's going to get, and only the hardware can make improvements. That's what's happened with graphics... things are faster than they used to be because for the most part the CPU doesn't really do graphics anymore... it's off-loaded to the GPU, freeing up the CPU for other work. Most modern libraries now take advantage of that, which is why they're faster than they used to be.

    That said, also learning about Assembly helped my back in the day (now with speeds that they are, I don't need to worry about squeeziong every possible tick out of a CPU) to right tighter code and "efficient" code in VB. It forced me to think about hte little things, like how I structure my If statements and how I run loops. I still kind of do it, but to a much lesser extent now.


    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    Frenzied Member 2kaud's Avatar
    Join Date
    May 2014
    Location
    England
    Posts
    1,148

    Re: how optimizate the programming?

    The authoritative source re algorithms is Donald Knuth's 'Art of Computer Programming'
    https://www.amazon.co.uk/Computer-Pr...102/ref=sr_1_1
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  4. #4

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,923

    Re: how optimizate the programming?

    i have 1 sub for change the brush\pen.... i must change the brush\pen, but i used an if for test if is the same, of previous, so i can win so much speed
    Last edited by joaquim; Mar 15th, 2024 at 08:51 AM.
    VB6 2D Sprite control

    To live is difficult, but we do it.

  5. #5
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,821

    Re: how optimizate the programming?

    Quote Originally Posted by joaquim View Post
    i don't choose any programming language, because these question is for all programming languages...
    everyone can create their own algorithm, but some can be slow and others can be faster...
    ok... if we use Graphics libraries, they can be much faster than CPU functions.... but forgetting these, what is the best steps for we create a much more faster algorithm?
    seems a basic question, but i didn't learned about optimization code on school... all most everything that i learned was by me(ebooks and forums)
    Also get familiar with a good benchmarking / performance profiler if you really want to see what different algorithms and performance tweaks actually change. Be aware that modern compilers can often perform a lot of optimisations as well, sometimes trying to write optimised code can defeat the compiler's ability to generate more efficient code.

  6. #6

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,923

    Re: how optimizate the programming?

    why the programming books(or general programming books) don't speak about optimization code?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  7. #7
    Frenzied Member 2kaud's Avatar
    Join Date
    May 2014
    Location
    England
    Posts
    1,148

    Re: how optimizate the programming?

    There are two distinct optimisations - algorithm optimisations which are covered in good/advanced algorithm books and program optimisations which are covered in good/advanced language specific books. Both are important. IMO the main one being algorithm optimisation.
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C++23 Compiler: Microsoft VS2022 (17.6.5)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width