Results 1 to 13 of 13

Thread: For ... Next loop in Assembler with VB code ?

  1. #1

    Thread Starter
    Addicted Member Abilio's Avatar
    Join Date
    May 2003
    Location
    Aveiro - Portugal
    Posts
    222

    For ... Next loop in Assembler with VB code ?

    Anyone know how to create a For ... Next loop in Assembler and place it into a VB program ? Is this possible to do ? If not, how can I create a ASM dll that accepts 3 Long's, lets say: Like having a For ... Next loop and inside this loop (ASM) call a VB function. Is this possible ?

  2. #2
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926

    Re: For ... Next loop in Assembler with VB code ?

    I don't think so.
    Why do you need it?
    Frans

  3. #3

    Thread Starter
    Addicted Member Abilio's Avatar
    Join Date
    May 2003
    Location
    Aveiro - Portugal
    Posts
    222

    Re: For ... Next loop in Assembler with VB code ?

    I don't think so.
    Why do you need it?


    Well, What I want is only to be able to put speed into VB loops. For ... Next loops are slower and if it is possible to do what I am waiting for, it will be great !

    Don't you agree ?

  4. #4
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: For ... Next loop in Assembler with VB code ?

    Do-Loops are faster then For-Next but I don't know what you're doing so...


    Has someone helped you? Then you can Rate their helpful post.

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: For ... Next loop in Assembler with VB code ?

    Loops are generally slowed by what is going on within them, rather than the loop itself. (oh, and calling a function, even from ASM, will be much slower).

    A little tip, declare the loop variable as Long rather than Integer, it is faster

    If you post your code we can help find the 'problem'.

  6. #6

    Thread Starter
    Addicted Member Abilio's Avatar
    Join Date
    May 2003
    Location
    Aveiro - Portugal
    Posts
    222

    Re: For ... Next loop in Assembler with VB code ?

    If you post your code we can help find the 'problem'.

    I want to read a large random file with a UDT . Making a loop in VB it takes to much time (for me !) and then I remember that if it was possible to implement something using ASM to do the job, would be better. Like having a function with some parameters like: FirstRecord, LastRecord and UDT and then, read the #file and displaying results for example in a MsFlexGrid. It will be a great optimization ! And of course that integers are faster ! But sometimes we need longs !

  7. #7
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: For ... Next loop in Assembler with VB code ?

    I think my wording before confused you - Longs are faster than Integers

    I'm not sure, but I think having files with a UDT is quite slow (compared to text/binary files). Having a large file is obviously slow, and is probably what is causing the speed issue.

    If you post the code, we can point out the parts of it that could be improved, and show you how to make it faster.

    If your code is 'bad', using ASM won't make it much better - improving what you have is likely to make a much larger improvement.

  8. #8

    Thread Starter
    Addicted Member Abilio's Avatar
    Join Date
    May 2003
    Location
    Aveiro - Portugal
    Posts
    222

    Re: For ... Next loop in Assembler with VB code ?

    If your code is 'bad', using ASM won't make it much better - improving what you have is likely to make a much larger improvement.

    I believe my code is not so "bad" However, VB speed is not so good ! Try to manipulate graphics using pure VB code ! And don't know ASM but I know that - in some situations - we can call ASM code (a pre-compiled string) using CallWindowProc and this is very very fast ! This is the reason why - if possible - I would like to try something in ASM. I know that a question like this one is not usual, but I also know that some people have ASM knowledge and are also VB programmers ! I am only waiting for ... Thanks anyway !

  9. #9
    Fanatic Member namrekka's Avatar
    Join Date
    Feb 2005
    Location
    Netherlands
    Posts
    639

    Re: For ... Next loop in Assembler with VB code ?

    Using assembler in VB is possible. You can find some info with Google "assembler vb".

    If you understand German: ActiveVB

    If it is worth for a loop?

  10. #10

    Thread Starter
    Addicted Member Abilio's Avatar
    Join Date
    May 2003
    Location
    Aveiro - Portugal
    Posts
    222

    Re: For ... Next loop in Assembler with VB code ?

    Using assembler in VB is possible. You can find some info with Google "assembler vb".


    Yes ! This is a answer ! Thanks ! I will have a search now !


  11. #11
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: For ... Next loop in Assembler with VB code ?

    The only thing you will achieve trying to use ASM to optimise a For-Next loop is to go backwards rather rapidly from the calling overhead. There quite frankly is nothing much to optimise.

    For maths, VB is very fast. The only reason you find it slower is because of the runtime DLL dependency, and the fact that your graphics algorithms are probably not very well optimised for VB.

    Post any code you may have and we can try and improve it.

  12. #12
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: For ... Next loop in Assembler with VB code ?

    There is an AddIn for VB6 that allows you to use Inline assembly in your VB code:

    http://www.planet-source-code.com/vb...62038&lngWId=1

    That way there, you won't need external DLL calls.

  13. #13

    Thread Starter
    Addicted Member Abilio's Avatar
    Join Date
    May 2003
    Location
    Aveiro - Portugal
    Posts
    222

    Re: For ... Next loop in Assembler with VB code ?

    There is an AddIn for VB6 that allows you to use Inline assembly in your VB code:

    I Knew ! ... Someone, someday will came with some help ! That's it ! Thank's a lot !

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