由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - why vb code faster than csharp???
相关主题
求助!这段code如何使用?【包子求助】20M*20M的loop怎么搞?
Any possibility to make this expression faster?如何实现N层循环嵌套
[合集] C#里面的动态数组是怎样定义的?Perl 6 改动很大很恶心
golang性能比C和Cpp差好遠,尤其在非x86平台,跟本不是宣傳的Question about OleDb...
golang為什麼語法和關鍵詞這麼冷門?I need visual basic 6 english version
how to assign new value to loop variables?这里高手很多, 我就趁机会问一个严肃的问题吧
LabVIEW问题:对高手来说很简单!Scripting language的几个问题
请教一道练习题(C,OS)问一个vc++ 2008的问题
相关话题的讨论汇总
话题: c#话题: dim话题: csharp话题: using话题: faster
进入Programming版参与讨论
1 (共1页)
e*****r
发帖数: 379
1
Anybody can tell why vb.net codes for looping is faster than Csharp?
s********o
发帖数: 861
2
How do you know that vb.net is faster than C# for looping?
v******n
发帖数: 421
3
it's possible that VB compiler does more optimization than C# compiler

【在 e*****r 的大作中提到】
: Anybody can tell why vb.net codes for looping is faster than Csharp?
a****l
发帖数: 8211
4
it's much more possible that LZ just mistakenly thought vb is faster. VB,
especially after VB6, is based on .net framework, so its code is not much
different from C# code.

【在 v******n 的大作中提到】
: it's possible that VB compiler does more optimization than C# compiler
e*****r
发帖数: 379
5
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Timers;
using System.IO;
namespace My_Speed_Test
{
class Program
{
static void Main(string[] args)
{
DateTime tic = DateTime.Now;
UInt32 d=200;
double dd = 200;
int s = 0;
for (int a=1;a<=10000;a++)
{
for (int b=1;b<=10000;b++)
{
for (int c=1;c<=10;c++)
e*****r
发帖数: 379
6
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim a, b, c, s As Integer
s = 0
Dim d As Integer
d = 250
Dim dd As Double
dd = 250
Dim tic, toc As String
tic = (Now().Millisecond) / 1000 + Now().Second + (Now().Minute) *
60
For a = 1 To 10000
For b = 1 To 10000
For c = 1 To 10
dd = dd * 5.1234567
e*****r
发帖数: 379
7
above are C# codes and vb.net codes respectively(both compiled by vs.net 2008 Express):
In my laptop, results for speed testing:
Matlab:
ver 7.1: limit of array size overlimit for 1E4*1e4*1e1 size, has to
change to loop format 20x for loop
Total time: 38.01second
VB.net: total loop 1e9 (1 billion)
total time: 18.64 second
VSharp.net:
total time:21.5 second!!!
netSDK_CSC:
total time: 21.625 second!!!
Python 2.5:
10000x1000x10 loops with For-Loop (it's a very special one!)
e*****r
发帖数: 379
8
It can't be interpreted simply by "overhead" costs (>3 second difference
between vb.net and C# codes), since there is no overhead (to my
understanding) between the two. CIL codes for both C# and VB.net should be
the same for both, aren't they?
I have been expecting vb.net "FOR loop" will be slower than that of C# due to
some overhead costs, but instead! no!
c**t
发帖数: 2744
9
why not use exactly same init and format for both VB.NET and C#?

to

【在 e*****r 的大作中提到】
: It can't be interpreted simply by "overhead" costs (>3 second difference
: between vb.net and C# codes), since there is no overhead (to my
: understanding) between the two. CIL codes for both C# and VB.net should be
: the same for both, aren't they?
: I have been expecting vb.net "FOR loop" will be slower than that of C# due to
: some overhead costs, but instead! no!

g*****n
发帖数: 420
10
你反编译一下Assembly,看一下生成的IL指令不就知道原因了?
1 (共1页)
进入Programming版参与讨论
相关主题
问一个vc++ 2008的问题golang為什麼語法和關鍵詞這麼冷門?
Delphi这个语言是不是已经死了?how to assign new value to loop variables?
各位大仙,说说这个VS和VCLabVIEW问题:对高手来说很简单!
事实胜于雄辩,图来了请教一道练习题(C,OS)
求助!这段code如何使用?【包子求助】20M*20M的loop怎么搞?
Any possibility to make this expression faster?如何实现N层循环嵌套
[合集] C#里面的动态数组是怎样定义的?Perl 6 改动很大很恶心
golang性能比C和Cpp差好遠,尤其在非x86平台,跟本不是宣傳的Question about OleDb...
相关话题的讨论汇总
话题: c#话题: dim话题: csharp话题: using话题: faster