|
-
Sep 14th, 2005, 05:23 AM
#1
Thread Starter
Addicted Member
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 ?
-
Sep 14th, 2005, 06:43 AM
#2
Re: For ... Next loop in Assembler with VB code ?
I don't think so.
Why do you need it?
-
Sep 14th, 2005, 01:54 PM
#3
Thread Starter
Addicted Member
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 ?
-
Sep 14th, 2005, 02:29 PM
#4
-
Sep 14th, 2005, 04:16 PM
#5
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'.
-
Sep 14th, 2005, 06:10 PM
#6
Thread Starter
Addicted Member
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 !
-
Sep 14th, 2005, 06:36 PM
#7
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.
-
Sep 15th, 2005, 04:27 AM
#8
Thread Starter
Addicted Member
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 !
-
Sep 15th, 2005, 04:38 AM
#9
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?
-
Sep 15th, 2005, 04:41 AM
#10
Thread Starter
Addicted Member
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 !
-
Sep 15th, 2005, 05:10 AM
#11
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.
-
Sep 15th, 2005, 07:57 AM
#12
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.
-
Sep 15th, 2005, 08:02 AM
#13
Thread Starter
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|