C# compilervergleich
-
Und hier kommt das was #Develop daraus gemacht hat:
// Microsoft (R) .NET Framework IL Disassembler. Version 2.0.50727.42 // Copyright (c) Microsoft Corporation. All rights reserved. // Metadata version: v1.1.4322 .assembly extern System.Windows.Forms { .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. .ver 1:0:5000:0 } .assembly extern mscorlib { .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. .ver 1:0:5000:0 } .assembly extern System.Drawing { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: .ver 1:0:5000:0 } .assembly Apfel { .custom instance void [mscorlib]System.Reflection.AssemblyProductAttribute::.ctor(string) = ( 01 00 00 00 00 ) // --- The following custom attribute is added automatically, do not uncomment ------- // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(bool, // bool) = ( 01 00 01 01 00 00 ) .custom instance void [mscorlib]System.Reflection.AssemblyDelaySignAttribute::.ctor(bool) = ( 01 00 00 00 00 ) .custom instance void [mscorlib]System.Reflection.AssemblyTrademarkAttribute::.ctor(string) = ( 01 00 00 00 00 ) .custom instance void [mscorlib]System.Reflection.AssemblyCopyrightAttribute::.ctor(string) = ( 01 00 00 00 00 ) .custom instance void [mscorlib]System.Reflection.AssemblyKeyFileAttribute::.ctor(string) = ( 01 00 00 00 00 ) .custom instance void [mscorlib]System.Reflection.AssemblyCompanyAttribute::.ctor(string) = ( 01 00 00 00 00 ) .custom instance void [mscorlib]System.Reflection.AssemblyConfigurationAttribute::.ctor(string) = ( 01 00 00 00 00 ) .custom instance void [mscorlib]System.Reflection.AssemblyDescriptionAttribute::.ctor(string) = ( 01 00 00 00 00 ) .custom instance void [mscorlib]System.Reflection.AssemblyTitleAttribute::.ctor(string) = ( 01 00 00 00 00 ) .hash algorithm 0x00008004 .ver 1:0:2203:35627 } .mresource public Apfel.MainForm.resources { // Offset: 0x00000000 Length: 0x00000D6E // WARNING: managed resource file Apfel.MainForm.resources created } .module Apfel.exe // MVID: {A21FAF73-A3EB-4C74-8BD5-C6504207AD00} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0002 // WINDOWS_GUI .corflags 0x00000001 // ILONLY // Image base: 0x03120000 // =============== CLASS MEMBERS DECLARATION =================== .class public auto ansi beforefieldinit Apfel.MainForm extends [System.Windows.Forms]System.Windows.Forms.Form { .field private class [System.Windows.Forms]System.Windows.Forms.Button button1 .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 13 (0xd) .maxstack 1 IL_0000: ldarg.0 IL_0001: call instance void [System.Windows.Forms]System.Windows.Forms.Form::.ctor() IL_0006: ldarg.0 IL_0007: call instance void Apfel.MainForm::InitializeComponent() IL_000c: ret } // end of method MainForm::.ctor .method public hidebysig static void Main(string[] args) cil managed { .entrypoint .custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01 00 00 00 ) // Code size 11 (0xb) .maxstack 1 IL_0000: newobj instance void Apfel.MainForm::.ctor() IL_0005: call void [System.Windows.Forms]System.Windows.Forms.Application::Run(class [System.Windows.Forms]System.Windows.Forms.Form) IL_000a: ret } // end of method MainForm::Main .method private hidebysig instance void InitializeComponent() cil managed { // Code size 223 (0xdf) .maxstack 4 IL_0000: ldarg.0 IL_0001: newobj instance void [System.Windows.Forms]System.Windows.Forms.Button::.ctor() IL_0006: stfld class [System.Windows.Forms]System.Windows.Forms.Button Apfel.MainForm::button1 IL_000b: ldarg.0 IL_000c: call instance void [System.Windows.Forms]System.Windows.Forms.Control::SuspendLayout() IL_0011: ldarg.0 IL_0012: ldfld class [System.Windows.Forms]System.Windows.Forms.Button Apfel.MainForm::button1 IL_0017: ldc.i4 0xb8 IL_001c: ldc.i4 0x170 IL_0021: newobj instance void [System.Drawing]System.Drawing.Point::.ctor(int32, int32) IL_0026: callvirt instance void [System.Windows.Forms]System.Windows.Forms.Control::set_Location(valuetype [System.Drawing]System.Drawing.Point) IL_002b: ldarg.0 IL_002c: ldfld class [System.Windows.Forms]System.Windows.Forms.Button Apfel.MainForm::button1 IL_0031: ldstr "button1" IL_0036: callvirt instance void [System.Windows.Forms]System.Windows.Forms.Control::set_Name(string) IL_003b: ldarg.0 IL_003c: ldfld class [System.Windows.Forms]System.Windows.Forms.Button Apfel.MainForm::button1 IL_0041: ldc.i4.s 104 IL_0043: ldc.i4.s 40 IL_0045: newobj instance void [System.Drawing]System.Drawing.Size::.ctor(int32, int32) IL_004a: callvirt instance void [System.Windows.Forms]System.Windows.Forms.Control::set_Size(valuetype [System.Drawing]System.Drawing.Size) IL_004f: ldarg.0 IL_0050: ldfld class [System.Windows.Forms]System.Windows.Forms.Button Apfel.MainForm::button1 IL_0055: ldc.i4.0 IL_0056: callvirt instance void [System.Windows.Forms]System.Windows.Forms.Control::set_TabIndex(int32) IL_005b: ldarg.0 IL_005c: ldfld class [System.Windows.Forms]System.Windows.Forms.Button Apfel.MainForm::button1 IL_0061: ldstr "button1" IL_0066: callvirt instance void [System.Windows.Forms]System.Windows.Forms.Control::set_Text(string) IL_006b: ldarg.0 IL_006c: ldfld class [System.Windows.Forms]System.Windows.Forms.Button Apfel.MainForm::button1 IL_0071: ldarg.0 IL_0072: ldftn instance void Apfel.MainForm::Button1Click(object, class [mscorlib]System.EventArgs) IL_0078: newobj instance void [mscorlib]System.EventHandler::.ctor(object, native int) IL_007d: callvirt instance void [System.Windows.Forms]System.Windows.Forms.Control::add_Click(class [mscorlib]System.EventHandler) IL_0082: ldarg.0 IL_0083: ldc.i4.5 IL_0084: ldc.i4.s 13 IL_0086: newobj instance void [System.Drawing]System.Drawing.Size::.ctor(int32, int32) IL_008b: callvirt instance void [System.Windows.Forms]System.Windows.Forms.Form::set_AutoScaleBaseSize(valuetype [System.Drawing]System.Drawing.Size) IL_0090: ldarg.0 IL_0091: call valuetype [System.Drawing]System.Drawing.Color [System.Drawing]System.Drawing.Color::get_White() IL_0096: callvirt instance void [System.Windows.Forms]System.Windows.Forms.Control::set_BackColor(valuetype [System.Drawing]System.Drawing.Color) IL_009b: ldarg.0 IL_009c: ldc.i4 0x228 IL_00a1: ldc.i4 0x1c6 IL_00a6: newobj instance void [System.Drawing]System.Drawing.Size::.ctor(int32, int32) IL_00ab: call instance void [System.Windows.Forms]System.Windows.Forms.Form::set_ClientSize(valuetype [System.Drawing]System.Drawing.Size) IL_00b0: ldarg.0 IL_00b1: call instance class [System.Windows.Forms]System.Windows.Forms.Control/ControlCollection [System.Windows.Forms]System.Windows.Forms.Control::get_Controls() IL_00b6: ldarg.0 IL_00b7: ldfld class [System.Windows.Forms]System.Windows.Forms.Button Apfel.MainForm::button1 IL_00bc: callvirt instance void [System.Windows.Forms]System.Windows.Forms.Control/ControlCollection::Add(class [System.Windows.Forms]System.Windows.Forms.Control) IL_00c1: ldarg.0 IL_00c2: ldstr "MainForm" IL_00c7: call instance void [System.Windows.Forms]System.Windows.Forms.Control::set_Name(string) IL_00cc: ldarg.0 IL_00cd: ldstr "MainForm123" IL_00d2: callvirt instance void [System.Windows.Forms]System.Windows.Forms.Control::set_Text(string) IL_00d7: ldarg.0 IL_00d8: ldc.i4.0 IL_00d9: call instance void [System.Windows.Forms]System.Windows.Forms.Control::ResumeLayout(bool) IL_00de: ret } // end of method MainForm::InitializeComponent .method private hidebysig instance void Button1Click(object sender, class [mscorlib]System.EventArgs e) cil managed { // Code size 373 (0x175) .maxstack 4 .locals init ([0] class [System.Drawing]System.Drawing.Graphics my, [1] class [System.Drawing]System.Drawing.Pen blackpen, [2] class [System.Drawing]System.Drawing.Pen whitepen, [3] float64 xmin, [4] float64 xmax, [5] float64 ymin, [6] float64 ymax, [7] class Apfel.complex Xn, [8] class Apfel.complex C, [9] int32 test, [10] int32 x, [11] int32 y, [12] int32 counter, [13] valuetype [System.Drawing]System.Drawing.Size CS$00000002$00000000, [14] valuetype [System.Drawing]System.Drawing.Size CS$00000002$00000001, [15] valuetype [System.Drawing]System.Drawing.Size CS$00000002$00000002, [16] valuetype [System.Drawing]System.Drawing.Size CS$00000002$00000003) IL_0000: ldarg.0 IL_0001: ldfld class [System.Windows.Forms]System.Windows.Forms.Button Apfel.MainForm::button1 IL_0006: ldc.i4.0 IL_0007: callvirt instance void [System.Windows.Forms]System.Windows.Forms.Control::set_Visible(bool) IL_000c: ldarg.0 IL_000d: call instance class [System.Drawing]System.Drawing.Graphics [System.Windows.Forms]System.Windows.Forms.Control::CreateGraphics() IL_0012: stloc.0 IL_0013: call valuetype [System.Drawing]System.Drawing.Color [System.Drawing]System.Drawing.Color::get_Black() IL_0018: ldc.r4 1. IL_001d: newobj instance void [System.Drawing]System.Drawing.Pen::.ctor(valuetype [System.Drawing]System.Drawing.Color, float32) IL_0022: stloc.1 IL_0023: call valuetype [System.Drawing]System.Drawing.Color [System.Drawing]System.Drawing.Color::get_Red() IL_0028: ldc.r4 1. IL_002d: newobj instance void [System.Drawing]System.Drawing.Pen::.ctor(valuetype [System.Drawing]System.Drawing.Color, float32) IL_0032: stloc.2 IL_0033: ldc.r8 -0.74546800000000002 IL_003c: stloc.3 IL_003d: ldc.r8 -0.74538499999999996 IL_0046: stloc.s xmax IL_0048: ldc.r8 0.11297500000000001 IL_0051: stloc.s ymin IL_0053: ldc.r8 0.11304400000000001 IL_005c: stloc.s ymax IL_005e: newobj instance void Apfel.complex::.ctor() IL_0063: stloc.s Xn IL_0065: newobj instance void Apfel.complex::.ctor() IL_006a: stloc.s C IL_006c: ldc.i4.0 IL_006d: stloc.s test IL_006f: ldc.i4.0 IL_0070: stloc.s x IL_0072: br IL_014d IL_0077: ldc.i4.0 IL_0078: stloc.s y IL_007a: br IL_0131 IL_007f: ldloc.s C IL_0081: ldloc.s x IL_0083: conv.r8 IL_0084: ldarg.0 IL_0085: call instance valuetype [System.Drawing]System.Drawing.Size [System.Windows.Forms]System.Windows.Forms.Form::get_Size() IL_008a: stloc.s CS$00000002$00000000 IL_008c: ldloca.s CS$00000002$00000000 IL_008e: call instance int32 [System.Drawing]System.Drawing.Size::get_Width() IL_0093: conv.r8 IL_0094: div IL_0095: ldloc.s xmax IL_0097: ldloc.3 IL_0098: sub IL_0099: mul IL_009a: ldloc.3 IL_009b: add IL_009c: stfld float64 Apfel.complex::real IL_00a1: ldloc.s C IL_00a3: ldloc.s y IL_00a5: conv.r8 IL_00a6: ldarg.0 IL_00a7: call instance valuetype [System.Drawing]System.Drawing.Size [System.Windows.Forms]System.Windows.Forms.Form::get_Size() IL_00ac: stloc.s CS$00000002$00000001 IL_00ae: ldloca.s CS$00000002$00000001 IL_00b0: call instance int32 [System.Drawing]System.Drawing.Size::get_Height() IL_00b5: conv.r8 IL_00b6: div IL_00b7: ldloc.s ymax IL_00b9: ldloc.s ymin IL_00bb: sub IL_00bc: mul IL_00bd: ldloc.s ymin IL_00bf: add IL_00c0: stfld float64 Apfel.complex::imag IL_00c5: ldloc.s Xn IL_00c7: ldc.r8 0.0 IL_00d0: stfld float64 Apfel.complex::imag IL_00d5: ldloc.s Xn IL_00d7: ldc.r8 0.0 IL_00e0: stfld float64 Apfel.complex::real IL_00e5: ldc.i4.0 IL_00e6: stloc.s counter IL_00e8: br.s IL_0119 IL_00ea: ldloc.s Xn IL_00ec: ldloc.s Xn IL_00ee: call class Apfel.complex Apfel.complex::op_Multiply(class Apfel.complex, class Apfel.complex) IL_00f3: ldloc.s C IL_00f5: call class Apfel.complex Apfel.complex::op_Addition(class Apfel.complex, class Apfel.complex) IL_00fa: stloc.s Xn IL_00fc: ldloc.s Xn IL_00fe: callvirt instance float64 Apfel.complex::betragsquadr() IL_0103: ldc.r8 4. IL_010c: ble.un.s IL_0113 IL_010e: ldc.i4.1 IL_010f: stloc.s test IL_0111: br.s IL_0122 IL_0113: ldloc.s counter IL_0115: ldc.i4.1 IL_0116: add IL_0117: stloc.s counter IL_0119: ldloc.s counter IL_011b: ldc.i4 0x1f4 IL_0120: ble.s IL_00ea IL_0122: ldloc.s test IL_0124: brtrue.s IL_0128 IL_0126: br.s IL_012b IL_0128: ldc.i4.0 IL_0129: stloc.s test IL_012b: ldloc.s y IL_012d: ldc.i4.1 IL_012e: add IL_012f: stloc.s y IL_0131: ldloc.s y IL_0133: ldarg.0 IL_0134: call instance valuetype [System.Drawing]System.Drawing.Size [System.Windows.Forms]System.Windows.Forms.Form::get_Size() IL_0139: stloc.s CS$00000002$00000002 IL_013b: ldloca.s CS$00000002$00000002 IL_013d: call instance int32 [System.Drawing]System.Drawing.Size::get_Height() IL_0142: ble IL_007f IL_0147: ldloc.s x IL_0149: ldc.i4.1 IL_014a: add IL_014b: stloc.s x IL_014d: ldloc.s x IL_014f: ldarg.0 IL_0150: call instance valuetype [System.Drawing]System.Drawing.Size [System.Windows.Forms]System.Windows.Forms.Form::get_Size() IL_0155: stloc.s CS$00000002$00000003 IL_0157: ldloca.s CS$00000002$00000003 IL_0159: call instance int32 [System.Drawing]System.Drawing.Size::get_Width() IL_015e: ble IL_0077 IL_0163: ldstr "Fertig" IL_0168: call valuetype [System.Windows.Forms]System.Windows.Forms.DialogResult [System.Windows.Forms]System.Windows.Forms.MessageBox::Show(string) IL_016d: pop IL_016e: ldloc.0 IL_016f: callvirt instance void [System.Drawing]System.Drawing.Graphics::Dispose() IL_0174: ret } // end of method MainForm::Button1Click } // end of class Apfel.MainForm .class public auto ansi beforefieldinit Apfel.complex extends [mscorlib]System.Object { .field public float64 imag .field public float64 real .method public hidebysig specialname static class Apfel.complex op_Addition(class Apfel.complex rhs, class Apfel.complex lhs) cil managed { // Code size 50 (0x32) .maxstack 3 .locals init ([0] class Apfel.complex result, [1] class Apfel.complex CS$00000003$00000000) IL_0000: newobj instance void Apfel.complex::.ctor() IL_0005: stloc.0 IL_0006: ldloc.0 IL_0007: ldarg.0 IL_0008: ldfld float64 Apfel.complex::imag IL_000d: ldarg.1 IL_000e: ldfld float64 Apfel.complex::imag IL_0013: add IL_0014: stfld float64 Apfel.complex::imag IL_0019: ldloc.0 IL_001a: ldarg.0 IL_001b: ldfld float64 Apfel.complex::real IL_0020: ldarg.1 IL_0021: ldfld float64 Apfel.complex::real IL_0026: add IL_0027: stfld float64 Apfel.complex::real IL_002c: ldloc.0 IL_002d: stloc.1 IL_002e: br.s IL_0030 IL_0030: ldloc.1 IL_0031: ret } // end of method complex::op_Addition .method public hidebysig specialname static class Apfel.complex op_Multiply(class Apfel.complex rhs, class Apfel.complex lhs) cil managed { // Code size 78 (0x4e) .maxstack 4 .locals init ([0] class Apfel.complex result, [1] class Apfel.complex CS$00000003$00000000) IL_0000: newobj instance void Apfel.complex::.ctor() IL_0005: stloc.0 IL_0006: ldloc.0 IL_0007: ldarg.0 IL_0008: ldfld float64 Apfel.complex::real IL_000d: ldarg.1 IL_000e: ldfld float64 Apfel.complex::real IL_0013: mul IL_0014: ldarg.0 IL_0015: ldfld float64 Apfel.complex::imag IL_001a: ldarg.1 IL_001b: ldfld float64 Apfel.complex::imag IL_0020: mul IL_0021: sub IL_0022: stfld float64 Apfel.complex::real IL_0027: ldloc.0 IL_0028: ldarg.0 IL_0029: ldfld float64 Apfel.complex::real IL_002e: ldarg.1 IL_002f: ldfld float64 Apfel.complex::imag IL_0034: mul IL_0035: ldarg.0 IL_0036: ldfld float64 Apfel.complex::imag IL_003b: ldarg.1 IL_003c: ldfld float64 Apfel.complex::real IL_0041: mul IL_0042: add IL_0043: stfld float64 Apfel.complex::imag IL_0048: ldloc.0 IL_0049: stloc.1 IL_004a: br.s IL_004c IL_004c: ldloc.1 IL_004d: ret } // end of method complex::op_Multiply .method public hidebysig instance float64 betragsquadr() cil managed { // Code size 32 (0x20) .maxstack 3 .locals init ([0] float64 CS$00000003$00000000) IL_0000: ldarg.0 IL_0001: ldfld float64 Apfel.complex::imag IL_0006: ldarg.0 IL_0007: ldfld float64 Apfel.complex::imag IL_000c: mul IL_000d: ldarg.0 IL_000e: ldfld float64 Apfel.complex::real IL_0013: ldarg.0 IL_0014: ldfld float64 Apfel.complex::real IL_0019: mul IL_001a: add IL_001b: stloc.0 IL_001c: br.s IL_001e IL_001e: ldloc.0 IL_001f: ret } // end of method complex::betragsquadr .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 1 IL_0000: ldarg.0 IL_0001: call instance void [mscorlib]System.Object::.ctor() IL_0006: ret } // end of method complex::.ctor } // end of class Apfel.complex // ============================================================= // *********** DISASSEMBLY COMPLETE *********************** // WARNING: Created Win32 resource file H:\Eigene Dateien\EigeneProgs\C#\Apfel\bin\Debug\disasm.res
-
Dir ist schon klar das #Develop und die MS IDEs den selben Compiler verwenden, oder?
Evtl verwendet SharpDevelop einfach nur nicht die selben Commandline Parameter für den Compiler.
Der Compiler ist im .NET Framework enthalten. nur so btw.
BR
evilissimo
-
da bin ich mir nicht sicher ob #Develop wirklich das .Net ding nutzt.
Aber wenn ja eigentlich umso verwunderlicher, das die Unterschiede so krass sind.
Was können denn für Parameter anders sein?
Die Einstellungen in den IDEs habe ich auf Codeoptimierung.Hat jemand anderes vlt. auch schon sowas festgestellt?
-
#develop:
// Metadata version: v1.1.4322
#develop verwendet den Compiler von .Net 1.1.4322 auf deinem System.
VC# 2005:
// Metadata version: v2.0.50727
Die Microsoft IDE verwendet den neuen Compiler von .Net 2.0.50727. Dieser ist weiter entwickelt und besitzt unter Umständen andere Instruktionen.
So wie es aussieht, hast du zwei .Net-Versionen auf deinem Rechner. Das ist kein Problem, aber #develop benutzt diejenige, mit der es ausgeführt wird.
-
class Program { static void Main(string[] args) { double xmin = -0.745468; double xmax = -0.745385; double ymin = 0.112975; double ymax = 0.113044; complex Xn = new complex(); complex C = new complex(); int test = 0; double mul_real = 1 / ((double)1280 * (xmax - xmin)) + xmin); double mul_imag = 1 / ((double)1024 * (ymax - ymin)) + ymin); for (int x = 0; x <= 1280; x++) { C.real = ((double)x * mul_real; for (int y = 0; y <= 1024; y++) { C.imag = ((double)y * mul_imag; Xn.imag = 0; Xn.real = 0; for (int counter = 0; counter <= 500; counter++) { Xn = (Xn * Xn) + C; if (Xn.betragsquadr() > 4) { test = 1; //hier würde jetzt ein roter Punkt entstehen break; } } if (test == 0) { //und hier würde ein schwarzer Pkt entstehen } else test = 0; } } Console.WriteLine("Fertig"); } }
-
Hatte mich verlesen und dadurch falschen Code gepostet.
double mul_real = 1 / ((double)1280 * (xmax - xmin)); double mul_imag = 1 / ((double)1024 * (ymax - ymin)); for(int x = 0;x < 1280;++x) { C.real = ((double)x * mul_real) + xmin; for(int y = 0;y < 1024;++y) { C.imag = ((double)y * mul_imag) + ymin;
-
vergleich das mal lieber mit .GNU oder Mono, wobei Tests von Mono in einer letzten CUJ AUsgabe ziemlich schlecht ausgingen.
-
Also ich habe jetzt wirklich, schritt für schritt alles nochmal probiert:
Die ergebnisse sind ungefähr gleich. Keine Ahnung warum das gestern nicht so war, habe beide male im release modus getestet, mit CodeOptimierung und ohne grafik
Ich habe auch beide Versionen vorher ein paarmal laufen lassen.
-
Achso hatte ich vergessen zu schreiben, selbst die unterschiedliche Compilerversion erklärt nicht komplett das Verhalten.
es hat ein bissel was ausgemacht aber nicht enscheidend.
-
Dieser Thread wurde von Moderator/in Marc++us aus dem Forum Rund um die Programmierung in das Forum C# und .NET verschoben.
Im Zweifelsfall bitte auch folgende Hinweise beachten:
C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?Dieses Posting wurde automatisch erzeugt.