Solved

Conversion from Access2000 to C++

Posted on 2000-05-09
10
178 Views
Last Modified: 2012-05-04
I have a problem solving algorithm I have developed in Access2000/VBA6.  The algorithm works great.  My question regards the efficiency increase my algorithm would receive if I re-wrote it in C++, VB and what development time I can expect.  

If access 2000 takes 1 hour to run the algorithm approximately how long can I expect it to take if I re-write it in:
A) C++
B) VB6

If it took me 100 hours to develop my algroithm (including interface) using Access 2000, approximately how long can I expect to develop in:
(I have no experience developing applications in C, 2 years in Access and VB)
A) C++
B) VB6

Thanks,

Billy
0
Comment
Question by:billy21
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 14

Expert Comment

by:wsh2
Comment Utility
You have to tell us more about your algorithm.. does it use recursion.. matrices.. and/or large amounts of memory? Do portions of it require linked lists.. table value insertions and deletions.. integer values or just plain old work the math co-processor work?

As far as writing the code.. with your background.. Visual Basic would be the natural choice.. as much of the syntax and commands you already know. Coding in C/C++ is VERY different than what you are accustomed to syntax wise.

Additionally, C/C++ coding in many instances is at a much lower level. What you can do in a couple of VB lines.. may take you twice as many in C/C++.. but keep in mind, when you do it the C/C++ way.. you can do it in an extremely efficient manner.. without extra machine instructions that a high level compiler (VB) may add in for superfulous features unneccesary to your particular application. C/C++ executables (programs) are much smaller than VBs, and can be deployed / run on client machines without having to install several megs worth of additional runtime libraries that are essential to VB to run in the first place.

From a brand new development standpoint.. hands down.. C/C++ takes longer. But in using C/C++ well, the end product is very often much tighter and efficient.. and in that you can very often garner substantial performance gains. However, as your library of C/C++ routines grow.. this development time will shrink to that of doing it in Visual Basic.

Through ActiveX Components (Controls, DLLs and EXEs) both languages can communicate with each other fairly easily. As such parts of your algorithm could be written with C/C++ efficiency and another part could be written with  Visual basic simplicity. As far as communicating with the Operating System, Visual Basic has come a LONG way, but still has a way to go when it comes to matching C/C++ for linking into Windows Operating System API calls. (Note: Windows itself is primarily written in C/C++ as is Linux and Unix.. with parts of it (mostly hardware interfaces) written in Assembler).

When it comes to Internet programming.. there is Java and VBScript. Java very much resembles C/C++ and VBScript it's Visual Basic counterpart. Both Java and C/C++ are universally supported on all Operating System platforms.. while VbScript and VB will only run on a Microsoft platform. However, neither language is used on an IBM Mainframe.. so in that regard.. they are equal. Even though VB is NOT universal, MicroSoft has fully endorsed it as a continuing core product of their Office suite of Applications, MSIE scripting,  and COM/DCOM processing structure. For all intensive purposes VB is here to stay.

Anyhow.. now that you have fallen asleep from reading all this <yawn>.. if I were you.. in your position.. I would definitely opt to go with Visual Basic. Your learning curve is going to be considerably shorter.. the principles / vocabulary that you learn with VB will often be applicable in your endeavor to master C/C++.. and finally, I believe you should master one language before embarking into another.. and with your 2 years of VBA experience you are already a good part of the way there.. <smile>
0
 
LVL 6

Author Comment

by:billy21
Comment Utility
The algorithm produces every possible combination of numbers and uses it to create a boolean matrix. It Can loop up to 75 thousand times and run for up to 1.5 hours depending on the user inputed criteria.  A large array of successful combinations are stored as matrices in a string variable with delimiters separating each matrix (ie: --xxxx----,---xxxxx---,...)

Billy
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
Comment Utility
I think, best way for you stay in VBA,
but computable part (that works 75000 times), make on C++/assembler(assembler
in 2 more fast, that C/C++ and in 10 times as VB). For using this you can or
make ActiveX control or (more simple )
some DLL. Of course, you know how use some DLL from VBA. Make DLL it was more
complicated, but now with last versions of VC/BC  it is very easy, there are
many books/articles about this theme and you can find many examples in MSDN.
0
 
LVL 12

Expert Comment

by:pjknibbs
Comment Utility
billy21: First of all I'd look at the algorithm. Is it as efficient as it could be? If it takes an hour and a half to perform 75000 loops, I'd say probably not. It would be better to optimise the algorithm in VB than rewrite it in a different language.

I'd also ask: since this algorithm uses Access 2000, is it the algorithm that's slow or the database access that's slow? If you're performing a database access operation on every one of those loops that's probably where the slowdown lies, and rewriting in C will give you virtually no benefit.
0
 
LVL 6

Author Comment

by:billy21
Comment Utility
pjknibbs,

It takes up to 1.5 hours because of the tasks carried out on successful combinations.  Tests are run to see whether or not a combindation fits the parameters required then if it does some extra code is run.  It isn't run on all of the 75K.  The  number of successful combinations depends entirely on the parameters set by the user.

What I really need from everybody is an educated guess.  I'm not going to be upset if you tell me it will run in 15 mins and it actually takes 25 mins.  There are no database operations in this code.  The user enters a whole lot of numbers on screen,  it uses the numbers to come up with a boolean matrix.  It scores each matrix and displays the top ten on screen for the user.  I only wrote it in VBA because development time was more important than efficiency.  Now efficiency is more important than development time.

How much more efficiently will it run?
How much time will I have to set aside for development?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 50 total points
Comment Utility
As i wrote , coefficient VB->C ~ 5 (depends from operations).
If you VBA time ~ 1.5 hour, same code
in C/C++ must work(i hope) ~ 18min.
0
 
LVL 14

Expert Comment

by:wsh2
Comment Utility
Billy21 writes:
"How much more efficiently will it run?
How much time will I have to set aside for development?"

The two questions are very closely related. To eke out performance gains from C/C++ takes quite a bit of experience and technique. The longer you work with and study C/C++ the more efficient and tight your code will become. In my experience it takes two years (full time) to Master a language.. and during that time.. in the process of learning you really do cut some crappy executing code out.. <guilty look>. At least with VB, you have a jump on this. I suppose the real question is - how much time do you have to spend to develop this and what are your educational resources?

I like to add one other thing.. over the last 10 years there has been a huge increase in processor power and memory speeds.. with a huge decrease in cost. The chicken and egg question always has been "Did Intel (Hardware) make MicroSoft (Software).. or was it the other way around?" Millions of expensive programming hours were spent optimizing code to run efficiently on 4.77mhz PCs.. then 12mhz.. 16mhz.. 25mhz.. etc.. etc.. that if you go to execute now, run in a blink of an eye. Microsoft was always known for writing big, sloppy, slow code.. but Intel (Cyrus or AMD) always had a hardware solution around the corner and when it came out Microsoft was there with code that worked. Now.. who made all the money.. Intel (hardware) or Microsoft (software)?

My recommendation to you is still..  get your program done in the most expedient manner.. and then worry about the efficiences later. Keep in mind, the whole time you are doing this.. the processor people are working on your side.. to make it run in a blink of the eye. As you already have considerable experience in VBA, I would suggest you Master your skills there before moving to a whole new programming language.
0
 
LVL 6

Author Comment

by:billy21
Comment Utility
Would there be a huge difference If I were to write in Visual C++6 than straight C++?
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
Comment Utility
What do you meens
>>straight C++
VC , as i know, works slow , but make
exellent exe code, that works (~) only 1.5 time worst as Assembler.

0
 
LVL 6

Author Comment

by:billy21
Comment Utility
Thank you for your assistance.

Billy
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now