Notice that MARKxxx stepped over the line Friday nite, and had his post in VB.Net removed. Please re-read the AUP, and heed gremmy's warning about 'skating on thin ice' as he meant. :rolleyes:
Printable View
Notice that MARKxxx stepped over the line Friday nite, and had his post in VB.Net removed. Please re-read the AUP, and heed gremmy's warning about 'skating on thin ice' as he meant. :rolleyes:
Didn't you code some project to compete with the vb6 version and found out that it took so much longer to get it to run at a reasonable state against vb6 and didn't it take you days to figure out that the .net was to blame for the slow down? I would like to see the results of both tests again. For some reason that test result for vb6 against vb.net wondered off.Quote:
Originally Posted by GremlinSa
For the insults, I took some too. So I gave some back. Vb6 is a fine language. If you don't like to hear the bad about the .net, fine. About the thin ice issue, perhaps when you give me proof that I am wrong I will stop bashing the .net. Have you wonder about that? The way you can shut me up is to prove me wrong? Are you just too busy to have time to back up your favorite language?
Thanks. I backed up all my post incase they are removed. Took sometime :(. btw I don't want things to go south. Trust meQuote:
Originally Posted by dglienna
Also isn't it weird that the vb6 forum has double(if not triple) the amount of people than the vb.net forum? I bet I know why too
Also, I have not received a private pm from a moderator yet stating I have received my fair warning.
The last time I got banned I had no warning. Whats the catch this time?
btw, who reads the eula ?
Wow, you've got 116 posts and you've already been banned once? That's impressive.
I don't know, but you seem to alternate between being reasonable and then flying off the handle.
But enough about that, I have one question.
What do you think the mid-term forcast is for jobs doing VB6?
At the end of the day, this business is about having the skills to be employable and because of the constantly changing nature of the business, folks involved in this business need to keep up with current technologies.
Now a dev can choose to stay with the older technologies like VC6 and VB6, but I would suspect, that if VB6/VC6 jobs dry up, an interview candidate is going to have a hard time convincing the interviewer that they are using the wrong technology.
This whole debate reminds me of a recent post in another forum where a guy ask if anyone still used notepad to write code and to compile on the command line any more. The guy went on to say that he felt you get a higher quality product that way.
It's so difficult to debate something like that because a guy just simply has no idea what he is missing with the newer IDE's if he hasn't spent sufficient time learning how to leverage the features of the IDE. Sure it's simple coding in notepad because all you need to worry about is the syntax of the language and how to compile.
Unfortunately, you don't get the additional features that help prevent syntax errors, or enable you to click on a compile error which takes you to the line of code where there is a problem. The current built-in debuggers are great too with the ability to inspect variables in a tool tip or even change variables on the fly. Of course if you haven't ever taken the time to learn a new IDE and learn its new features, then you really don't know what is being missed.
I kind of view this VB6 vs. current debate as the same thing. If you've looked at .Net 1.0, then you aren't getting the full picture of what .Net can do. With .Net 2.0 things really started happening. With .Net 3.0/3.5 it's even better. It's worth the investment.
Hmm, Have you not been folowing them properly ..Quote:
Originally Posted by Joeman
Task 1: Tile image on forms background..
VB6 = 94ms
Vb.NET = 1.38ms
Task 2: Initial testing
VB6 = 140ms
.NET = 250ms
Something to note about the .NET code, it was not properly tweeked and debugged for this task..
Task 3: Final Testing (And we tweeked .NET code here ..)
First Pass..
VB6 = 125ms
.NET = 125ms...
After Fine tweeks and full screen plotting
VB6 = 1232ms
.NET = 1060ms
Final stats: In terms of graphics only ...
Task 1 : .NET is almost 1000% faster (or 10 times Faster) ....
Task 2 : .NET (Badly done code) was 50% slower....
Task 3 : .NET (Checked and tweeked) was 10% Faster ....
If The Code in Task 2 was tweeked as was done in Task 3 we may have seen the same 10% improvement in speed ....
Hmmm as for the rest of your statement.... NO, it took a few days to find 'MY' bad .NET coding methods..
Code is only as good as the coder !!!!!!!!
In the Years that i've been here, I've never seen anyone throw out insults like you have ... This is a High quality Forum and the members here try to keep the discutions clean .. If you have a serious problem with any member rather take it to PM's, and keep the PUBLIC forum clean...Quote:
Originally Posted by Joeman
No One here has said that VB6 is not a good language, It was great in it's time.... But it's time has passed..Quote:
Originally Posted by Joeman
Also have you done anything to PROVE this bad about .NET, By your own addmision you do not use .NET, AND have no idea about what it is capable of ...
My favorite language is still VB6 .. no doubt about it, However, I've accepted .NET as the way foward and am trying to learn all there is about it. One thing is for sure, Long before i gett the full hang of .NET there will be a new Framework out that will change the way things get done, again...
Wont help .. Once the Post is deleted, 'YOU' cant replace it , Sorry to tell you that you wasted your time there...Quote:
Originally Posted by Joeman
Bet you dont ......Quote:
Originally Posted by Joeman
HMMM .. That the AUP Acceptable Use Policy, with a link at the bottom of each page.Quote:
Originally Posted by Joeman
Guys, after reading 5 pages of this thread, I felt my head will explode... or implode. :D Well, my vengeance will follow in having my 2 cents:
I also felt that the poll is a bit one sided; there're still many developers loving VB6; many of them use other languages, including C# or if you wish, dedicated scripting languages like lisp.
I gave up long time ago using VB6 for applications expected to work in a productive enviroment, but I still have it installed on, at least, one dev machine, just in case ;) ; not long ago, I needed a small test which was supposed to diagnose the output of a GPS receiver available on a COM port, and it took me ~30 sec to write a VB6 exe and have the report file saved; on the same machine, it takes ~10 sec to load VS2005 and >20 sec to setup a new project in it.
On the other hand, using managed code, it takes me less than a day of work to write a dialog based interface for a casual application (under 50 features) which also looks and feels good (lets say most users would find it ergonomic and intuitive); to achieve the same in VB6 would take a bit longer, and would not look as good as using, lets say, Windows Forms.
It was mentioned here about DoD approved security; I've seen products approved by DoD, and for some I've wrote components... not so impressed anymore, as I was imagining before, by watching Hollywood movies :p
I think I've seen somewhere in this thread, someone saying that there're cases where C# is faster than C++ :eek: my comment would be: "that's ludicrous... don't forget that 99.99% of the code running on your computer was probably written in C++" (can someone confirm / infirm that .NET Framework Interpreter was written in C++? how about C# compiler? should I go on?)
I don't wanna be on either side of VB .NET or VB6, but if I'd have to choose, I'd vote for the completely free one (I wouldn't pay for any of them). :rolleyes: 'till then, I'd use both, as long as I, personally, didn't pay for the license. :D In fact, I really think programming tools should be open source or at least free, and I would happily contribute all my free time for that; and that is not because MS couldn't spare the buck for charging on their dev tools, but because I'd like to be part of such project... helping fellow SW developers.
To keep this short, the last thing to mention is that one can even inject machine code in VB6 projects (as I'm describing in the article linked in my signature) and use function pointers (aka delegates), which proves, at least to myself, that no matter the language / environment, you can always push the limits further.
I wish you all the best "hammer" for the job... Cya around!
Thank you .. Back to the CORE question posed..Quote:
Originally Posted by Arjay
As you can see i split your post into 3 sections..
1: When i was job seeking 6 months back (and got my current job), there was only 1 job position open for a VB6 developer, and it was a contractual position for upto 12 months. Of the rest (about 1000 others) ~25% was VB.NET, ~25% ASP or ASPX, ~40% C, C++ or C#, and the ballance was perl, PHP etc...
2: VB6 will still always look good on your CV, however if you have nothing on the newer technologies, how can you offer any sort of Edge to the company.
3: This is the key aspect of it ... VC6 & VB6 Jobs are drying up.. many developing companies are moving to the newer languages because many of these can take better advantage of the newer technologies (Proccessor, OS, etc)...
With VB6 you are not able to take full advantage of multipul thread's, Dual Cores, nor is there any way to use 64bit core commands... This leaves you a little behind now, but as time passes you fall further and further behind..
Most developers seeking employment can't even read assembly, and no matter how old it is, knowing an architecture or two will always "look good" on your resume. If you know VB6 or not shouldn't be an imperative condition on employment requirements,... it is more important what you could have done in VB6, lets say, after working with it daily for 3 yrs; and that may include sucessful applications using multi-threading, running just fine on today's multiple core multiple processor platform!Quote:
Originally Posted by GremlinSA
My advice to all... learn as many languages / technologies you can, but learn them well,... especially to know when NOT to use them. :rolleyes:
Once in a while, it might be better to "re-invent the wheel" or "over-engineer"
Regards,
Lol.. You dont know how true that is.. One of my work colegues has not ever worked in VB6 , however he trained in VB.NET.Quote:
Originally Posted by Bornish
Now i just need a little clarity here, Are you advising :::Quote:
Originally Posted by Bornish
A)People that have just started in the trade with .NET to learn VB6.. (Learning Older languages)
B)People that are fluent in VB6 to learn .NET ..(Learning Newer Languages)
C)Just in general, every one must learn as much as they have time/money for.... (Learn in both directions, Newer and Older.)
Very good point! In my oppinion is a combination of A, B, C... meaning:Quote:
Originally Posted by GremlinSA
A. Learn about older languages to understand better the newer ones ;) Best example: ASM
B. Learn newer ones to know when there're easier / better ways to do something ;)
C. Learn both older and newer as long as you may use them... it's called being pro-active!... though you don't have to become an encyclopedia... I focus more on what helps me do my work, in the field I do programming; many times I learn things not related to programming, but to the field for which I write software for.
I hope I have clarified everything now; still is only an advice... I might be totaly wrong, or it doesn't fit everyone.
Best regards,
Well, you are missing a lot of features in the free version, as opposed to Professional. Other than that, we don't support piracy.
Theres the odd junior here that may say your wrong, but the seniors here would agree with you.Quote:
Originally Posted by Bornish
I think that it does not hurt to know more than one language, however I know some languages that i doubt anyone else here knows about, "Spss Quantum" and "In2form" .. These are market research related languages, that i spent 5 years studing, certified and all.. how ever very little use today, as i'm no longer in the market research sector..
But it does not hurt..
Okay I am back you .net lovers. I had to redo gremlinsa's code since the results were inconclusive due to lack of translating the code from vb6 to vb.net which in the result have made a new revision that drew lines and not a clef at all. How could this be? I don't know, but I assure you I had to fix his mistakes. Now we have a very well qualified app that looks like the vb6 version, but written in the .net. Now I am sure you know I don't code in the .net, but I got my hands dirty :(..... Well from the results of my conversion vb6 wins by a large margin. I mean so large it is not funny. vb6 is like 1000x faster.
If I did code this wrong, which I don't think I have, feel free to correct it............ The project is attached for vb.net
It has the clef picture just like the vb6 version. Too bad gremlinsa couldn't transfer the picture over.
You keep thinking that. Have you heard of brute force? I suppose the .net doesn't teach you that.Quote:
Originally Posted by GermlinSa
You still didn't answer my question. You told me where it is located, but you failed to answer my question.Quote:
Originally Posted by Joeman
Ok here I will comment on your "comparison"...Quote:
Originally Posted by GremlinSa
Task1: was a failed attempt has it was all done at runtime. So it is actually a lie. You should time the initial run of the exe and not after it has done it's work
Task2: Actually this is probably faster than Task1, but since Task1 does it at runtime.... it as invisible lag in the execution start up, so you can't see the delay
Task3: Finally after a few days you got it right, but the TEST WAS NOT DONE RIGHT!
LOOK AT MY VB.NET CONVERSION. IF YOU DON'T LIKE THE SPEED OF IT........... MAKE IT FASTER IF YOU CAN!!!
If I have overstated stuff or offended people, I do not mean to hurt you, but I do like to express myself ;)
Joeman, when you are interviewing for that .Net job, I suggest you take your new .Net app with you and mention that VB6 is 1000x faster. You're sure to land the job.
You didn't even look at it, but I may just do that lol
I know arjay is about to reply
I'm busy writing a C# XmlSerialization sample for another post.Quote:
Originally Posted by Joeman
Wow You realy do know how to dig yourself into a deep hole.... The Code i wrote to do the first task is on this post (Note File updated July 9th)Quote:
Originally Posted by Joeman
Stick to VB6, you write .NET apps like crap... my application written back then kicks you app's A$$...Quote:
Originally Posted by Joeman
.NET (Mine) = 234ms
.NET (Joeman) = 4992ms ...
I guess if your going to bash .NET your Going to Go out of your Way to use the slowest methods you can find...
Hmmm More personal Bashing... I guess the only way to show you, I DID ASK FOR THE IMAGE AND DOWNLOADED IT ...Quote:
Originally Posted by Joeman
This is a threat against Codeguru.... Against the AUP!!!!! ....Quote:
Originally Posted by Joeman
No one else complained about the comparison, some did get different results, however the results i posted has been accepted as close to acctual (In relation to graphics) ...Quote:
Originally Posted by Joeman
I DID, Long time ago already ... Look here on this post (Same link as above, just in case you did not see it)Quote:
Originally Posted by Joeman
That was not expressing yourself....Quote:
Originally Posted by Joeman
Yes it is and your project forgot to add 100 to the textbox... silly. Also your declare for your gettickcount is wrong. How did it even output right with it trying to return as long? Well, it is suppose to be integer. What were you thinking. Your app is flawed.
Your app takes 1937 ms while the vb6 takes 317ms. You lied! Way to go to trick people. EDIT: btw that is at full screen 1280 * 1024
The only reason people agreed with your results and tests is because they didn't look at them! I had to. Thanks for trying to cover up the .net slow factor with lies
I fixed your bug gremlin and uploaded it. I also uploaded the vb6 version with the vb.net version so everyone can have access to both at the same time.
and for me writing my version in the .net and finding the slowest method is a lie. I didn't do research. I typed in picturebox1. and the intellengise brought up the list of functions and that is the first one I saw. If it is that slow, I don't know why they would even put it in the .net for.
And I suppose yours is not ?????Quote:
Originally Posted by Joeman
I posted the app, with out making any claim that it is the fastest method or implimentation.. Yes i might not have declared the Gettickcount 100% correctly, but then neither did you... LOOK UP "Pinvoke" for the correct API Delacrations..
As for using Long instead of Integer... Long is a '64Bit Int' data type and Integer is a '32Bit Int' datatype.. so where will it 'loose' bits....
Yes My little test app is flawed.. But it was an initial test..
As for the FLAW of adding in the "100" in the text box... IF you looked at the screen shots posted.. they all showed the same number in the textbox.. 'PROOF' that the test was run with the same number of test loops.. For every test that i ran i posted screen shots showing the Test Forms size, as the test results are 'FLAWED' if the forms are not of identical size....
Show me a screen shot of the two forms next to each other, Showing the times...Quote:
Originally Posted by Joeman
I can easily get the VB6 code to work on a form thats 200 * 200 pixels, and the .NET code to work on a form that 400 * 400 pixels and say that the .NET took longer, Well sure, it's doing 4 times the work...
What I've done, is Posted test results, run on my Development system, with Screen shots of relevant details, and offered my opinion on the results, and others have looked at the Results that i've posted, AND Because I POST FULL Results, with screen shots, no one else has seen reason to doubt the results..
You've made hundreds of claims here, however you have not posted one shred of proof...
The only lies i see here are the ones that you post...
I honestly think it's better you go back to the sandbox and leave this to the Pro's...
Dude I will post results! and your form is at that small and getting around 290ms?? the vb6 will do that at 20 ms easily
Well there you go "I didn't do research." is all we needed to hear...Quote:
Originally Posted by Joeman
Go and do the research, until then stop spamming this thread..
Here are the 2 done at fullscreen. 1280 x 1024
Same size
They are attached. I had to compress the quality of them, but that was to be expected
Also the .net didn't warn me that I was doing anything wrong with using drawtobitmap. It sounded like a good ideal
Here is your vb.net version and wizbang vb6 version
Btw you are not a professional either. so stop saying you are. I can tell by your coding mistakes. GetTickcount Can't be long. It will append zeros in the bits and turn the number very wrong. try maximizing your form and reading the time. it will be like 4444411232 :(, but I fixed that for you
i have ran both of the apps and joeman is right and i think he is being pretty
nice about it because i would grab you by your nuts and show you no mercy :mad: :thumbd:
.Net scored 3500ms Vb6 scored 100ms
vb6 wins
if you dont believe me i will video tape it
:D i don't believe :eek: pls video tape :p LOLQuote:
Originally Posted by RealityIsForLocos
... and some think vb6 will die soon? even KKK didn't have so "warmed-up fans"... VB6 will live for at least as long as VBA and VB Script will be out there, somewhere...
K now, after the introduction, my real comment about these tests: they do not prove anything real to anyone... especially when the test involves graphics... do you guys know that hardware is more often the cause for bottlenecks than software? as well suited is a software for the hardware on which is running... as fast it wil be! take for example 64 bit compiled code running on a 32-bit machine through WOW... most probably would be slower than 32 bit software on the same machine; try running CE software on a desktop (using a PDA image)... even that the desktop processor is faster, the same software would execute faster on a PDA with slower processor; Intel compiler optimizes better for Intel processors; applications using OpenGL will draw faster on graphics cards with better OpenGL support; numbers (X ms versus Y ms) are meaningless without environment specs... and so on...
Conclusion: dedicated software is usually running faster; languages are NOT making applications faster or not, DEVELOPERS are responsible for that, and can have the help of compilers (and other dev tools)
Uf... can someone please CLOSE this thread?
Right, this was test one...... I think your results mirror the results posted here... .. BTW did you check the method that Hannes put foward.. with indepth testing of the code the time was confirmed...Quote:
Originally Posted by Joeman
This is also pure .NET code and smoked both my code and VB6 ......
So end of test one ... VB.NET is faster... WHY? .... Well it now includes methods to complete some of the regular tasks at a fraction of the time...
Then we did test two ... the results returned slightly inconclusive however VB6 was faster at this point ... Many pointed out mistakes and better methods in the .NET code that may have sped it up alot.. It was basically scrapped because Test 3 was put on the bench.
How ever this one was given to VB6.
Test 3 - Final VB6 Code
Here aftertaking in what was discussed in test 2, the better coded .NET version ran with equivalent times.. and when pressed harder .NET posted better times, Marginal, but better..
.NET Can and does run marginally faster than VB6, and after Tweeking code, you can get it upto 10% faster...
I redid TEST 3 .....
VB.NET Full screen test here
VB6 Full Screen test here
And I also belive that I was the one that pointed out that some of the equvalent functions can and do have different results.. CPU Wizard pointed out the .NET manages the code and has built in checks for invalid information..
.. Sorry to say, but i do belive that i'm a hell of a lot more professional than you could ever dream of becoming..Quote:
Originally Posted by Joeman
Professionals are human and do make mistakes, and the SINGLE mistake you claim that i've made was on something that i made no claim to be 100% anyway, It was code that i quickly did between working fulltime as a professional developer, writing articles for codeguru, Helping out other CG members, and SLEEP... Between all that i also try to spend time with my wife and my grandkids...
I also have hundreds of applications written years ago still running in there respective area's, I have put some of my Personal projects up as Open source software.. FREE for all to use as they see fit.. One has already hit the 2000 downloads mark here on CG alone.
My professional programming ability has been demonstrated. Yours has not.
About test1... It does work, but it only does tiling. It doesn't prove anything unless your going to keep the app tiling. In that case, it would be faster. Also, you can't use test1 for anything else, but for tiling. You can't use it to make a simple game. Also, test3 may have been faster, but it is still alot slower than the vb6 version. Did you look at the difference? Download the attachment I just did and rerun them at full screen.
If you code professionally, I am amazed. Seriously.
Why is your test still tiling lines for? That wasn't the real test. The real test was with a music treble clef sign. ....
Also I didn't see your vb6 code for tiling of the line. I am sure you made mistakes. Can you redirect it to me?
All the links are in my previous post.Quote:
Originally Posted by Joeman
And unles someone can come up with a different test, other than graphics, I think it's time this thread dies.
If all three tests done gave the same result i'd say fine. However to completely ignore the last two tests because the results are not what you want, and focus on only the slowest .NET code and say 'There you see .NET is 1000 times slower' is not right...Quote:
Originally Posted by RealityIsForLocos
Have a look at the .NET code Hannes posted for test 1, it performed so well that i had to escalate it up and divide the time to get a true result...
Put up or back out.. Lets the rest of us see what you've done..Quote:
Originally Posted by Joeman
I think we can agree straight apis are faster than managed .net apis, but We should come up with a better test. I just don't know what since I keep thinking simple = something visual.
Btw, most of my code is probably against some rule on the aup or in c++
Since you told me to post some of my work, I will give you alittle bit. Although it is still incomplete it is 100% functional.
I won't tell you what it does or how to use it, but it is an ongoing project. I am building this not to reinvent the wheel, but learn how to build that wheel :DCode:#ifndef ASTORAGE_H
#define ASTORAGE_H
#include <iostream>
#include <windows.h>
using namespace std;
#ifndef Debug_Astorage
#define Debug_AStorage 0 // set to 1 if you want to show debug information in the console, but it will slow down the array's speed alot.
#endif
template<class YourType>
class AList
{
public:
int Number;
int CreationNumber;
//private:
YourType YourObject;
AList * Previous;
AList * Next;
AList() : YourObject()
{
Number = CreationNumber = 0 ;
Previous = Next = NULL;
}
};
template<class YourType>
class AStorage
{
private:
AList<YourType> * Current;
AList<YourType> * FirstRegistered;
AList<YourType> * LastRegistered;
AList<YourType> * SafeZone;
int Count;
public:
YourType& AStorage::operator[]( int Id );
bool AddQuanity( int Amount );
bool RemoveCurrentId();
bool Remove( int Id );
bool Clear();
YourType* Start();
YourType* Next();
YourType* Previous();
YourType* End();
YourType* Add();
YourType* GoTo( int Id );
int FindByAddress( YourType* SearchFor );
int FindByValue( YourType SearchFor );
bool AddBefore(int Id);
bool AddAfter(int Id);
bool Swap( int Id );
bool MoveAfter( int Id );
bool MoveBefore( int Id );
bool Swap( int Id_1, int Id_2 );
bool MoveAfter( int Id_1, int Id_2 );
bool MoveBefore( int Id_1, int Id_2 );
bool ResetId( int Id );
bool ResetCurrentId();
int GetCurrentId();
int GetId( YourType * Item );
int GetCurrentCreationId();
int GetCreationId( YourType * Item );
int GetCount();
AStorage()
{
Count = -1;
Current = LastRegistered = FirstRegistered = NULL;
SafeZone = new AList<YourType>;
}
};
// code that can't be placed in the AStorage.cpp file because of c++ limitations..//
template<class YourType>
YourType& AStorage<YourType>::operator[]( int Id )
{
if ( Debug_AStorage ) cout << "Array[ " << Id << " ]" << endl;
if ( GoTo( Id ) == NULL )
{
if ( Debug_AStorage ) cout << "A Problem has occurred. Please stay in the boundry of this array" << endl;
if ( Count + 1 == 0 )
{
cout << "This array is empty" << endl;
cout << "Please put something in this array first" << endl;
}
if ( Id <= (Count + 1) / 2)
{
if (FirstRegistered == NULL)
{
cout << "You have nothing in this array" << endl;
cout << "Placing you in a safe area" << endl;
Current = SafeZone;
}else{
cout << "I have placed you at the 0" << endl;
Current = FirstRegistered;
}
}
else
{
if (LastRegistered == NULL)
{
cout << "You have no ending in this array!!!!! Now I am very confused :(" << endl;
cout << "Placing you in a safe area" << endl;
Current = SafeZone;
}else{
cout << "I have placed you at the last registered" << endl;
Current = LastRegistered;
}
}
}
YourType& Sending = Current->YourObject;
if(Current == SafeZone) Current = NULL;
return Sending;
}
template<class YourType>
bool AStorage<YourType>::AddQuanity( int Amount )
{
if ( Debug_AStorage ) cout << "AddQuanity( " << Amount << " );" << endl;
int I = 0;
while ( I < Amount )
{
if ( Add() == NULL )
{
// adding didn't work. let's revert our steps
if ( Debug_AStorage ) cout << "Adding failed" << endl;
if ( Debug_AStorage ) cout << "Retracing steps back to where nothing was added" << endl;
Current = LastRegistered;
while ( I > 0 )
{
if ( RemoveCurrentId() != true )
{
if ( Debug_AStorage ) cout << "Something went wrong with removing the remaining enities from the AddQuanity function which returned an error" << endl;
}
I--;
};
return false;
}
I++;
}
return true;
}
template<class YourType>
bool AStorage<YourType>::RemoveCurrentId()
{
if ( Debug_AStorage ) cout << "RemoveCurrentId();" << endl;
if ( Debug_AStorage ) cout << "Removing current id" << endl;
if ( Current == NULL )
{
if ( Debug_AStorage ) cout << "Id was nulled" << endl;
return false;
}
AList<YourType> * DestroyRegistered = Current;
AList<YourType> * PrevRegistered = Current->Previous;
AList<YourType> * NextRegistered = Current->Next;
if ( PrevRegistered )
{
PrevRegistered->Next = DestroyRegistered->Next;
}
if ( NextRegistered )
{
NextRegistered->Previous = PrevRegistered;
}
while ( Current->Next != NULL )
{
Next();
Current->Number--;
};
Count--;
Current = PrevRegistered;
if ( DestroyRegistered == LastRegistered )
{
LastRegistered = PrevRegistered;
}
if ( DestroyRegistered == FirstRegistered )
{
Current = FirstRegistered = FirstRegistered->Next;
}
delete DestroyRegistered;
if ( Debug_AStorage ) cout << "Id was removed" << endl;
return true;
}
template<class YourType>
bool AStorage<YourType>::Remove( int Id )
{
if ( Debug_AStorage ) cout << "Remove( " << Id << " ); " << endl;
if ( Id > Count || Id < 0 || Current == NULL )
{
if ( Debug_AStorage ) cout << "You tried to remove an id which is out of bounds" << endl;
return false;
}
int CurrentId = Current->Number;
if ( GoTo( Id ) == NULL )
{
if ( Debug_AStorage ) cout << "I couldn't go to the id of " << Id << endl;
return false;
}
if ( RemoveCurrentId() != true )
{
if ( Debug_AStorage ) cout << "Something went wrong with the Remove function while calling RemoveCurrentId" << endl;
return false;
}
if ( GoTo( CurrentId ) == NULL )
{
if ( Debug_AStorage ) cout << "I couldn't go back to the original Id which was " << CurrentId << endl;
return false;
}
if ( Debug_AStorage ) cout << "I removed id of " << Id << endl;
return true;
}
template<class YourType>
bool AStorage<YourType>::Clear()
{
//cout << Count << endl;
if ( Debug_AStorage ) cout << "Clear();" << endl;
Current = LastRegistered;
if ( Current == NULL )
{
if ( Debug_AStorage ) cout << "The last registered in the array was nulled, so I suppose the array is already cleared" << endl;
return false;
}
while ( Count >= 0 )
{
RemoveCurrentId();
};
//cout << Count << endl;
}
template<class YourType>
YourType* AStorage<YourType>::Start()
{
if ( Debug_AStorage ) cout << "Start();" << endl;
if ( Debug_AStorage ) cout << "Setting current to the first registered" << endl;
Current = FirstRegistered;
if ( Current == NULL )
{
if ( Debug_AStorage ) cout << "There is nothing in the array" << endl;
return NULL;
}
return &FirstRegistered->YourObject;
}
template<class YourType>
YourType* AStorage<YourType>::Next()
{
if ( Debug_AStorage ) cout << "Next();" << endl;
if ( Debug_AStorage ) cout << "Setting current to the next" << endl;
Current = Current->Next;
if ( Current == NULL )
{
if ( Debug_AStorage ) cout << "There is no next" << endl;
return NULL;
}
return &Current->YourObject;
}
template<class YourType>
YourType* AStorage<YourType>::Previous()
{
if ( Debug_AStorage ) cout << "Previous();" << endl;
if ( Debug_AStorage ) cout << "Setting current to the previous" << endl;
Current = Current->Previous;
if ( Current == NULL )
{
if ( Debug_AStorage ) cout << "There are no previous" << endl;
return NULL;
}
return &Current->YourObject;
}
template<class YourType>
YourType* AStorage<YourType>::End()
{
if ( Debug_AStorage ) cout << "End();" << endl;
if ( Debug_AStorage ) cout << "Setting current to the last registered" << endl;
Current = LastRegistered;
return &LastRegistered->YourObject;
}
template<class YourType>
YourType* AStorage<YourType>::Add()
{
if ( Debug_AStorage ) cout << "Add();" << endl;
if ( Current == NULL )
{
Current = LastRegistered = FirstRegistered = new AList<YourType>;
Count++;
return &FirstRegistered->YourObject;
}
AList<YourType> * PrevRegistered = LastRegistered;
try
{
LastRegistered = LastRegistered->Next = new AList<YourType>;
}
catch ( bad_alloc& )
{
if ( Debug_AStorage ) cout << "Error has occurred while creating a new spot. Is the computer out of memory?" << endl;
LastRegistered = PrevRegistered;
return NULL;
}
LastRegistered->Previous = PrevRegistered;
LastRegistered->Number = ++Count;
LastRegistered->CreationNumber = LastRegistered->Number;
return &LastRegistered->YourObject;
}
template<class YourType>
YourType* AStorage<YourType>::GoTo( int Id )
{
if ( Debug_AStorage ) cout << "GoTo( " << Id << " );" << endl;
if ( Id > Count || Id < 0 )
{
if ( Debug_AStorage ) cout << "Access is out of bounds" << endl;
return NULL;
}
if ( Current == NULL )
{
if ( FirstRegistered != NULL )
{
Current = FirstRegistered;
}
else
{
if ( Debug_AStorage ) cout << "First registered is nulled, so I am assuming this array is empty" << endl;
return NULL;
}
}
if ( Id == 0 )
{
Current = FirstRegistered;
}
if ( Id == LastRegistered->Number)
{
Current = LastRegistered;
}
while ( Current->Number != Id )
{
if ( Current->Number < Id )
{
Next();
}
else
{
Previous();
}
};
return &Current->YourObject;
}
template<class YourType>
int AStorage<YourType>::FindByAddress( YourType* SearchFor )
{
if ( Debug_AStorage ) cout << "FindByAddress( " << SearchFor << " );" << endl;
if ( Debug_AStorage ) cout << "Searching..." << endl;
for ( int I = 0; I <= Count; I++ )
{
if ( GoTo( I ) == NULL )
{
continue;
}
if ( Debug_AStorage ) cout << "Scanning: " << &Current->YourObject << endl;
if ( &Current->YourObject == SearchFor )
{
if ( Debug_AStorage ) cout << "Item has been found and returning with " << I << " as the id in array" << endl;
return I;
}
}
if ( Debug_AStorage ) cout << "I couldn't find what your were searching for" << endl;
if ( Debug_AStorage ) cout << "You were searching for " << SearchFor << endl;
return -1;
}
template<class YourType>
bool AStorage<YourType>::AddBefore(int Id)
{
return AddAfter(Id - 1);
}
template<class YourType>
bool AStorage<YourType>::AddAfter(int Id)
{
Add();
GoTo(LastRegistered->Number);
return MoveAfter(Id);
}
template<class YourType>
int AStorage<YourType>::FindByValue( YourType SearchFor )
{
if ( Debug_AStorage ) cout << "FindByValue( " << SearchFor << " );" << endl;
if ( Debug_AStorage ) cout << "Searching..." << endl;
for ( int I = 0; I <= Count; I++ )
{
if ( GoTo( I ) == NULL )
{
continue;
}
if ( Debug_AStorage ) cout << "Scanning: " << Current->YourObject << endl;
if ( Current->YourObject == SearchFor )
{
if ( Debug_AStorage ) cout << "Item has been found and returning with " << I << " as the id in array" << endl;
return I;
}
}
if ( Debug_AStorage ) cout << "I couldn't find what your were searching for" << endl;
if ( Debug_AStorage ) cout << "You were searching for " << SearchFor << endl;
return -1;
}
template<class YourType>
bool AStorage<YourType>::Swap( int Id )
{
// act like 5 is the one being swaped with 8..
// GoTo(5);
// Swap(8);
// 5 swaps 8
if ( Debug_AStorage ) cout << "Swap( " << Id << " );" << endl;
if ( Id > Count || Id < 0 || Current->Number == Id || Current == NULL )
{
if ( Current != NULL )
{
if ( Debug_AStorage ) cout << "Id of " << Id << " wasn't a valid swap" << endl;
}
else
{
if ( Debug_AStorage ) cout << "Id of " << Current->Number << " wasn't a valid swap due to it being nulled" << endl;
}
return false;
}
AList<YourType>* First = Current; // 5
AList<YourType>* FirstNext = First->Next; // 6
AList<YourType>* FirstPrevious = First->Previous; // 4
GoTo( Id ); // GoTo(8);
AList<YourType>* Second = Current; // 8
AList<YourType>* SecondNext = Second->Next; // 9
AList<YourType>* SecondPrevious = Second->Previous; // 7
GoTo( First->Number );
if ( Id == First->Number + 1 )
{
return MoveAfter( Id ); // we do this incase they are right beside each other; otherwise they will loop each other's own address by assigning there own neigherboords to each other and causes a loop
}
if ( Id == First->Number - 1 )
{
return MoveBefore( Id ); // ''
}
if ( FirstPrevious != NULL )
{
FirstPrevious->Next = Second; // 4 points forward to 8
}
Second->Next = FirstNext; // 8 point forward to 6
if ( SecondPrevious != NULL )
{
SecondPrevious->Next = First; // 7 points forward to 5
}
First->Next = SecondNext; // 5 points forward to 9
if ( SecondNext != NULL )
{
SecondNext->Previous = First; // 9 points back to 5
}
First->Previous = SecondPrevious; // 5 points back to 7
if ( FirstNext != NULL )
{
FirstNext->Previous = Second; // 6 points back to 8
}
Second->Previous = FirstPrevious; // 8 points back to 4
int LastRegisteredID = LastRegistered->Number;
if ( Id == LastRegisteredID )
{
LastRegistered = First; // last = 5
}
if ( Id == 0 )
{
FirstRegistered = First; // first = 5
}
if ( First->Number == 0 )
{
FirstRegistered = Second; // first = 8
}
if ( First->Number == LastRegisteredID )
{
LastRegistered = Second; // last = 8
}
Second->Number = First->Number; // 8 = 5
First->Number = Id; // 5 = 8
return true; // it worked! :D
}
template<class YourType>
bool AStorage<YourType>::MoveAfter( int Id )
{
if ( Debug_AStorage ) cout << "MoveAfter( " << Id << " );" << endl;
// 5 goes after 8
if ( Id > Count || Id < -1 || Current == NULL || Current->Number == Id || Current->Number == Id + 1 )
{
if ( Debug_AStorage ) cout << "Invaild MoveAfter call" << endl;
if ( Id > Count || Id < -1 )
{
if ( Debug_AStorage ) cout << "Id to swap with is out of bounds" << endl;
}
return false;
}
if ( Id < 0 || Id >= LastRegistered->Number ) // do this instead because you cant really move anything before the beginning and end sense there is nothing there and this does a swap and move to make moving others to the beginning or end possible
{
if ( Id < 0 )
{
int Number = Current->Number;
Swap( 0 );
GoTo( Number );
return MoveAfter( 0 );
}
if ( Id >= LastRegistered->Number )
{
int Number = Current->Number;
Swap( LastRegistered->Number );
GoTo( Number );
return MoveBefore( LastRegistered->Number );
}
}
AList<YourType>* First = Current; // 5
AList<YourType>* FirstPrevious = First->Previous; // 4
AList<YourType>* FirstNext = First->Next; // 6
GoTo( Id );
AList<YourType>* Second = Current; // 8
AList<YourType>* SecondPrevious = Second->Previous; // 7
AList<YourType>* SecondNext = Second->Next; // 9
GoTo( First->Number );
if ( First == LastRegistered )
{
LastRegistered = FirstPrevious;
}
//going up
if ( FirstPrevious != NULL )
{
FirstPrevious->Next = FirstNext; // 4 points to 6
}
Second->Next = First; // 8 points to 5
First->Next = SecondNext; // 5 points to 9
//going down
if ( FirstNext != NULL )
{
FirstNext->Previous = FirstPrevious; // 6 points to 4
}
First->Previous = Second; // 5 points to 8
if ( SecondNext != NULL )
{
SecondNext->Previous = First; // 9 points to 5
}
// this section fixes the ordering count after moving things around in the array
bool Up = First->Number < Id;
bool Down = !Up;
AList<YourType>* Counter;
if ( Up )
{
if (Debug_AStorage) cout << "Number is lower than the one it is moving after" << endl;
// 5 goes after 8
Counter = First; // 5
First->Number = Second->Number; // 5 = 8
Counter = Counter->Previous; // 8 which will be 7 when it is counted down in the loop below
while ( Counter != FirstPrevious )
{
Counter->Number--; // 8, 7, 6 will be turnt to 7, 6, 5
Counter = Counter->Previous; // 7, 6, 4 ... 4 will not be processed because the while loop will be broken
};
}
if ( Down )
{
if (Debug_AStorage) cout << "Number is higher than the one it is moving after" << endl;
// 8 goes after 5
Counter = First; // 8
First->Number = Second->Number + 1; // 8 = 6 = 5+1
Counter = Counter->Next; // 6 which will be 7 when it is counted up in the loop below
while ( Counter != FirstNext )
{
Counter->Number++; // 6, 7 will be turnt to 7, 8
Counter = Counter->Next; // 7, 9 ... 9 will not be processed because the while loop will be broken
};
}
return true;
}
template<class YourType>
bool AStorage<YourType>::MoveBefore( int Id )
{
if ( Debug_AStorage ) cout << "MoveBefore( " << Id << " );" << endl;
return MoveAfter( Id -1 );
}
template<class YourType>
bool AStorage<YourType>::Swap( int Id_1, int Id_2 )
{
if ( Debug_AStorage ) cout << "Swap( " << Id_1 << ", " << Id_2 << " );" << endl;
GoTo( Id_1 );
return Swap( Id_2 );
}
template<class YourType>
bool AStorage<YourType>::MoveAfter( int Id_1, int Id_2 )
{
if ( Debug_AStorage ) cout << "MoveAfter( " << Id_1 << ", " << Id_2 << " );" << endl;
GoTo( Id_1 );
return MoveAfter( Id_2 );
}
template<class YourType>
bool AStorage<YourType>::MoveBefore( int Id_1, int Id_2 )
{
if ( Debug_AStorage ) cout << "MoveBefore( " << Id_1 << ", " << Id_2 << " );" << endl;
GoTo( Id_1 );
return MoveBefore( Id_2 );
}
template<class YourType>
bool AStorage<YourType>::ResetId( int Id )
{
if ( Debug_AStorage ) cout << "ResetId( " << Id << " );" << endl;
int CNumber = Current->Number;
GoTo( Id );
bool val = ResetCurrentId();
GoTo( CNumber );
return val;
}
template<class YourType>
bool AStorage<YourType>::ResetCurrentId()
{
if ( Debug_AStorage ) cout << "ResetCurrentId();" << endl;
if ( Current == NULL )
{
if ( Debug_AStorage ) cout << "Current is nulled" << endl;
return false;
}
AList<YourType>* Before = Current->Previous;
AList<YourType>* Present = Current;
AList<YourType>* Next = Current->Next;
AList<YourType>* NewOne;
try
{
NewOne = new AList<YourType>;
}
catch ( bad_alloc& )
{
if ( Debug_AStorage ) cout << "Error has occurred while creating a new spot. Is the computer out of memory?" << endl;
return false;
}
if ( Before != NULL )
{
Before->Next = NewOne;
}
if ( Next != NULL )
{
Next->Previous = NewOne;
}
NewOne->Number = Present->Number;
NewOne->CreationNumber = Present->CreationNumber;
NewOne->Next = Next;
NewOne->Previous = Before;
Current = NewOne;
// NewOne is now set
delete Present;
return true;
}
template<class YourType>
int AStorage<YourType>::GetCurrentId()
{
if ( Debug_AStorage ) cout << "GetCurrentId(); " << endl;
if ( Current != NULL )
{
return Current->Number;
}
else
{
if ( Debug_AStorage ) cout << "Current is nulled" << endl;
return -1;
}
}
template<class YourType>
int AStorage<YourType>::GetId( YourType * Item )
{
if ( Debug_AStorage ) cout << "GetId( " << Item << " );" << endl;
int CNumber = Current->Number;
FindByAddress(Item);
int val = Current->Number;
GoTo(CNumber);
return val;
}
template<class YourType>
int AStorage<YourType>::GetCurrentCreationId()
{
if ( Debug_AStorage ) cout << "GetCurrentId(); " << endl;
if ( Current != NULL )
{
return Current->CreationNumber;
}
else
{
if ( Debug_AStorage ) cout << "Current is nulled" << endl;
return -1;
}
}
template<class YourType>
int AStorage<YourType>::GetCreationId( YourType * Item )
{
if ( Debug_AStorage ) cout << "GetCreationId( " << Item << " );" << endl;
int CNumber = Current->Number;
FindByAddress(Item);
int val = Current->CreationNumber;
GoTo(CNumber);
return val;
}
template<class YourType>
int AStorage<YourType>::GetCount()
{
if ( Debug_AStorage ) cout << "GetCount();" << endl;
return Count + 1;
}
#endif // ASTORAGE_H
I told you I am no pro, but I don't think I am a mere newbie.
OK, this should be the final speed test, unless the results call for more.
This time there's no graphics, just pure math, in a loop. Also a CheckBox to allow selecting one of two different algorithms. Just as with the others, the TextBox determines the number of times through, and the time is shown in the TitleBar.
I should also point out, that the latest round of offending posts have not gone unnoticed. Those of you able to maintain your professionalism can give yourselves a pat on the back. The rest of you should feel free to slap yourselves silly, and may the fleas of a thousand camels infest your armpits :p
Might I also suggest something more complex, and look at performance for recursive algorithms? I know this allows for some variations in language use,but I still think that, as we've left graphics, it would be a useful comparison. A good algorithm might be the one at http://www.codeguru.com/forum/showthread.php?t=457281, although this would need rewriting in VB.NET, and my VB6 version could do with some clearing up...
This, however, may not show much speed until quite a large dataset is used...suggestions?
I was also thinking of something along the lines of string sorting, like the dreadfully slow BubbleSort algo. It's simple enough to translate to .net without much fuss I'd think.
Ahh ... yes.. I'm already thinking now about This VB6 Article on sorting... It Already does tick timing on each algo ..Quote:
Originally Posted by WizBang
I dont think that it'll take too long to duplicate it into VB.NET...
Time to knuckle down and do some coding ...
I think i'll do your Speed test first...
Yeah we need a good example to start off with. Simple recursive stuff isn't going to state much, but actually if you compare vb6 and vb.net to c++, you will find even the smallest stuff can show you how fast c++ is. Well I was bored and I decided to convert wizbang's code to c++. Although I didn't use the gui, I only used the console, I think it came out as a nice conversion.
Here is the c++ conversion. Now we need the .net conversion. After that. We will do something else.
Note that I didn't do error checking on the input from the console because it is very simple code. If it was mission critical, I would have :DCode:#include <iostream>
#include <windows.h>
#include <math.h>
using namespace std;
int main()
{
int I(0), J(0), K(0), T(0);
int Method(0);
SYSTEMTIME Time;
cout << "Please input the number of times to process: ";
cin >> J;
cout << endl;
cout << "Please select what method of process you want:" << endl;
cout << "0 to Process addition" << endl;
cout << "1 to Process randomization, division, multplication, power of and addition" << endl;
cout << endl;
cout << "Input: (0 or 1) ";
cin >> Method;
cout << endl;
T = GetTickCount();
for( I = 0; I <= J; I++ ){
if( Method == 0 ){
if( K > 0xFFFFFF) K = 0;
K = K + 1;
}else{
K = (rand() % 1) * 1000;
K = K * 2 / 3 * 5;
K = pow(K, 2);
GetLocalTime( &Time );
K = K + Time.wSecond;
}
}
T = GetTickCount() - T;
cout << "The time to process is: " << T << "ms" << endl;
return 0;
}
Why not compare something like the ability to get real work done on real world projects? In other words, look at the bigger picture. Comparing a string sort may be interesting (um, maybe not), but in the grand scheme of things, does it really matter if one approach is 2us slower than another?
Don't just copy over the app by doing the same approach (api's, etc.) that you did in VB6. Do it by way of a .Net approach from the ground up. For graphics work, try using WPF and see if you can recreate the music clef using the WPF primitives.
And it runs how fast? Not a comparison, nor a test. Plus this isn't about C++, remember?
How about something quite simple then which mixes algorithms and graphics work.
Such as a SuDoku solver.
I know I've got a VB6 one somewhere, and I'm certain it's been done to death on both platforms. I even have a 16 by 16 Su Doku which It took me about 4 hours to solve manually (there is a point where only one square can be filled...)
Yeah I know it isn't about c++, but I thought I told you why I made it. Although I do find c++ to be an alternative against the .net in whole
Well if you wanted a comparison:
Vb6 with 10000000 with method 2 was 12750 ms
c++ with 10000000 with method 2 was 2125 ms
Now the only slow down is that stupid api.
Also we are doing a speed test, so why not throw in c++? It will be fun!
For C++ test to be fair, we need also to subject it to the graphics test.
I've no doubt it'll be faster (the language structure is better designed), so who really cares? I suspect very few people who are proficent in c++ would chose to write in any form of VB when speed is an issue.
I agree with you there, but we are doing a speed test. If people don't want a c++ conversion, I won't bother, but I did what to demonstrate c++ against vb6 and the .net when speed is measured. As you can see I can write about 6x as much code in c++ until I hit the same speed in the vb6. So I am very curious to see how it benches out to vb.net. This is more of a personal thing. It doesn't have to be vb6 vs vb.net vs c++. It can just be vb6 vs vb.net. I just thought of c++ when I heard speed ;)
I hope that you dont mind but i moded it a little, and placed a listbox on the form.. and each test placed the time into the list.. (So i have a running list of times..)Quote:
Originally Posted by WizBang
Only change wasThis gives us Times on multiple runs..Code:Me.Caption = T
Changed to
List1.AddItem (T)
Results ... As normal VB6 Left, VB.NET right...
Run 1 (Unchecked) : (K = K + 1)
http://i141.photobucket.com/albums/r...other/Run1.jpg
Run 2 (Checked) : (full Calculations..)
http://i141.photobucket.com/albums/r...other/Run2.jpg
Attached is my VB.NET project...
So clearly there must be other benefits to using VB6 other than pure speed; otherwise everyone would be coding in C++.Quote:
Originally Posted by Joeman
Given that, do these speed comparisons really matter? Or is it all the other features that go into an programming environment (i.e. VB6, VC6, .Net, etc) what make it compelling enough to be the environment of choice?
I was just keeping with the speed ideal
I like the speed test gremlinsa. I am suprised the .net won on my machine against vb6. I don't know how, but it did. :)
Here are the timings I got for 10000000:
for method 1:
vb6 - 246ms
vb.net - 141 ms
c++ - 15ms
for method 2:
vb6 - 10062 ms
vb.net - 8172 ms
c++ - 1766ms
So now how fast is this in percent?
vb.net is 1.23x faster than vb6. This isn't much but this is something
vb6 runs only 0.8x the speed of the vb.net version
now for c++ ;) this is just for fun
c++ is 5.79x faster than vb6
c++ is 4.67x faster than vb.net
I really liked this test! :D