Results 1 to 3 of 3

Thread: Fastest multiplication (case pointer, in Delphi 7)

  1. #1

    Fastest multiplication (case pointer, in Delphi 7)

    I have a pointer "Linea" which I want to move to a certain position, so I used shl multiplications to optimize the operation. But taking a look to the CPU window, it seems to be slower than using normal multiplication. These are screenshots for 3 different operations to position the pointer:



    And Inc() isn't replaced by the inc operator.

  2. #2

    Fastest multiplication (case pointer, in Delphi 7)

    It is best to leave these things to the compiler to decide. About any compiler you find will optimize constant multiplication. So, in this case Delphi optimizes it to LEA, which indeed is the fastest way to multiply with 3.

  3. #3

    Fastest multiplication (case pointer, in Delphi 7)

    Then the old trick doesn't work anymore :cry:

Bookmarks

Posting Permissions

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