|
Pedram Behroozi wrote: Even 20MB is a huge size!
Do you realize this is the year 2008 and 20mb is a splash in the bucket these days? Maybe in 1991 with an 80MB hard drive it would be a whole different story
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Few issues to point out:
- you are comparing two totally different languages and environments. What is optimal in VB6 may not be optimal in C# and vice versa
- your code is not equal. You have several major differences in your code
- predefined labels in VB6
- in C# you access properties which you do not use in VB6
- you modify control collection in C# and so on
- the output is different in .Net (MSIL) than in VB6 (native EXE)
- you may have not optimized code and you may have DEBUG & TRACE options on in C# etc.
However, in real world situation, in most cases .Net beats VB6 in all areas, since you have more possibilities to achieve the same goal but in a more efficient way.
I'm all the time referring to .Net instead of C#, because C# is just one of the languages you can use in .Net. If you make the same test using VB.NET, you'll have similar results. However C# gives you the opportunity to use more efficient coding than VB.NET so it would be more reasonable choice for the language.
If performance still is an issue with MSIL code, you can always use ngen at target machine.
Mika
The need to optimize rises from a bad design
|
|
|
|
|
Mika Wendelius wrote: If performance still is an issue with MSIL code,
Definitely yes, I wrote a program that should read 5000 records from a file. I tried C# to add these records to a DataGridView control (I even tried simple ListBox) and to be honest with you C# done it in 20 seconds. But my uncle wrote this application via VB6 and japed me!
I actually preferred C#, but I need high speed and low size.
Mika Wendelius wrote: you can always use ngen at target machine.
What is "ngen at target machine"?
|
|
|
|
|
For the first comment: You must play by the rules of C#. If done properly, it beats VB6, that's for sure, but the code is not the same or even transferrable.
For the second comment: Native Image Generator (Ngen.exe)[^]
Mika
P.s. Have faith and work your way with C# and you'll show your uncle
The need to optimize rises from a bad design
|
|
|
|
|
Use AddRange.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
Move this line outside the loop
this.Controls.Add(lab[i]); and change it to
this.Controls.AddRange(lab);
|
|
|
|
|
They give the same result
|
|
|
|
|
The two pieces of code don't even do the same thing.
Why would you want to even create 3,000 labels for your form. I'd hate to see the UI with something like that.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Just for testing!
What about using StreamReader, BinaryReader, DataGridView, ListBox?
These classes and objects are common but these are not as fast as I need.
|
|
|
|
|
The .NET framework has put more funcionality into the Label object, so there is more overhead.
If all that you are going to do is to put ridiculous amounts of controls in the form, you can stick with VB6.
If you want to do something else, you can have very much use for it. For example, creating an instance of a class is considerably faster in C# compared to VB6.
You should also consider that VB6 is a dead language. There is no further development, and Microsoft doesn't support it any longer.
Pedram Behroozi wrote: Besides I have to insert approximately 100MB .Net Framework package in my installation package while I really don't need all of .Net Framework features
Where did you get hold of a 100 MB framework package? The .Net Framework 2.0 package is 22 MB.
Besides, you are comparing apples and oranges. There is a runtime library required for running VB6 programs also, the only difference is that VB6 is so old that the RTL has been included with every version of Windows for many years, just like the .NET framework 2 is included in Vista.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi there Pedram
Pedram Behroozi wrote: And my problem is speed!
Well, I think you have to use just C++
Pedram Behroozi wrote: C#: about 5seconds
VB6: less than a second!!!
I thought C# is faster
Pedram Behroozi wrote: Besides I have to insert approximately 100MB .Net Framework package in my installation package while I really don't need all of
You're right. It's very bad , because if we want to run our programs on the other systems , we have to install .Net framework
|
|
|
|
|
And if you want to run C++ applications, you have to install the C++ runtime. Hey, even VB has a runtime.
|
|
|
|
|
|
VB6 runtime is about 1.31 MB
|
|
|
|
|
But when I was working C++, I wasn't installing anything for running it on the destination system.
|
|
|
|
|
That's because, in a lot of cases, the runtime will already have been installed. Take a look at the msvcrt - that's the Microsoft Visual C++ RunTime. It's the same with .NET - over time, more and more systems will have .NET installed on them by default.
|
|
|
|
|
And to follow up with what Pete said, Vista has .NET pre-installed, just like XP has the C++ runtime (albeit an older one) pre-installed.
|
|
|
|
|
Judah Himango wrote: Vista has .NET pre-installed
Which version ?
|
|
|
|
|
Version 3.
On a related note, I understand Microsoft will be updating all .NET installations to .NET 3.5 SP1 later this year through Windows Update.
|
|
|
|
|
Well I think it's an Iranian problem!
In Iran we still use VBDOS, QBASIC and even GWBASIC. We still teaching these dead languages in our universities and... I don't want to vilify my country but it's a fact and our users don't interest in great .Net UI and features, based on this fact. They expect that application runs when they double-clicked on its icon without doing anything else, like installing!
Ok, I think I'm yacking.
Thank you all for helping.
|
|
|
|
|
Can someone help me or give me some sample code to read or display elements of an array (array could be one, 2,3, 4...dimensions). we need to read the array recursively and using not more than one loop. I don't know how to handle it. can someone shed some idea or code?
|
|
|
|
|
This sounds like a homework assignment, so I won't post the (easy) solution here.
Just one hint:
Loop over each item in the first dimension of the array and call this function recursively for each item.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
please helpme if you can. I will appreciate it.
|
|
|
|
|
He just did. he told you how to do it.
As has been said a thousand times, we'll help you do your homework but we wont do it for you!
|
|
|
|
|
With a little bit of thought you shouldn't need a loop at all. The real question is do you want to display the results, pre-order or post-order?
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|