C# compilervergleich



  • das sit ja eigentlich nicht meine Art aber ich wollte euch meine erkenntnisse nicht vorenthalten deswegen etwas crossposting.
    http://www.mycsharp.de/wbb2/thread.php?postid=74028#post74028

    Ich war schockiert!
    Okay es auf die langsame Grafik zu schieben war etwas dumm, aber ich hätte niemals gedacht das ich 4 min davor sitze und warte bis das bild da ist. 🙄 🙄



  • Dann poste doch am besten den relevanten IL-Code, damit man das Phänomen genauer untersuchen kann...



  • Okay, also ich ahbe eine Konsolen taugliche Version hier, geht ja nur um die Berechnung.

    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;
    
                for (int x = 0; x <= 1280; x++)
                    for (int y = 0; y <= 1024; y++)
                    {
                        C.real = ((double)x / (double)1280 * (xmax - xmin)) + xmin;
                        C.imag = ((double)y / (double)1024 * (ymax - ymin)) + ymin;
    
                        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");
    
            }
        }
    
        public class complex
        {
            public double imag;
            public double real;
    
            public static complex operator +(complex rhs, complex lhs)
            {
                complex result = new complex();
                result.imag = rhs.imag + lhs.imag;
                result.real = rhs.real + lhs.real;
                return result;
            }
    
            public static complex operator *(complex rhs, complex lhs)
            {
                complex result = new complex();
                result.real = (rhs.real * lhs.real) - (rhs.imag * lhs.imag);
                result.imag = (rhs.real * lhs.imag) + (rhs.imag * lhs.real);
                return result;
            }
    
            public double betragsquadr()
            {
                return (this.imag * this.imag + this.real * this.real);
            }
    
        }
    

    1280*1024 ist meine Bildschirmauflösung, näherungsweise ist das der bereich der auch dargestellt werden kann. Wenn man Windowsprogrammierung betreibt wird es etwas weniger sein, wegen dem Rahmen des Fensters. Sollte aber nicht die krassen unterschiede machen.



  • Ich meinte den IL-Code, den dir z.B. ILDASM anzeigt. Und zwar den von SharpDevelop erzeugten und den von VS.NET erzeugten.



  • Also das ist die diassembelte datei mit dem VS2005:

    //  Microsoft (R) .NET Framework IL Disassembler.  Version 2.0.50727.42
    //  Copyright (c) Microsoft Corporation.  All rights reserved.
    
    // Metadata version: v2.0.50727
    .assembly extern mscorlib
    {
      .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
      .ver 2:0:0:0
    }
    .assembly ApfelVS
    {
      .custom instance void [mscorlib]System.Reflection.AssemblyFileVersionAttribute::.ctor(string) = ( 01 00 07 31 2E 30 2E 30 2E 30 00 00 )             // ...1.0.0.0..
      .custom instance void [mscorlib]System.Runtime.InteropServices.GuidAttribute::.ctor(string) = ( 01 00 24 39 35 63 61 37 30 39 61 2D 38 39 33 65   // ..$95ca709a-893e
                                                                                                      2D 34 38 31 62 2D 39 37 37 39 2D 36 35 39 63 61   // -481b-9779-659ca
                                                                                                      36 65 33 38 35 39 35 00 00 )                      // 6e38595..
      .custom instance void [mscorlib]System.Runtime.InteropServices.ComVisibleAttribute::.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 12 43 6F 70 79 72 69 67 68 74 20 C2 A9 20   // ...Copyright .. 
                                                                                                      20 32 30 30 36 00 00 )                            //  2006..
      .custom instance void [mscorlib]System.Reflection.AssemblyProductAttribute::.ctor(string) = ( 01 00 07 41 70 66 65 6C 56 53 00 00 )             // ...ApfelVS..
      .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 07 41 70 66 65 6C 56 53 00 00 )             // ...ApfelVS..
    
      // --- The following custom attribute is added automatically, do not uncomment -------
      //  .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 ) 
    
      .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) 
      .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78   // ....T..WrapNonEx
                                                                                                                 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 )       // ceptionThrows.
      .hash algorithm 0x00008004
      .ver 1:0:0:0
    }
    .module ApfelVS.exe
    // MVID: {E4B6C441-12DA-42A5-A1A4-D18CF2EBA777}
    .imagebase 0x00400000
    .file alignment 0x00001000
    .stackreserve 0x00100000
    .subsystem 0x0003       // WINDOWS_CUI
    .corflags 0x00000001    //  ILONLY
    // Image base: 0x03120000
    
    // =============== CLASS MEMBERS DECLARATION ===================
    
    .class private auto ansi beforefieldinit ApfelVS.Program
           extends [mscorlib]System.Object
    {
      .method private hidebysig static void  Main(string[] args) cil managed
      {
        .entrypoint
        // Code size       329 (0x149)
        .maxstack  4
        .locals init ([0] float64 xmin,
                 [1] float64 xmax,
                 [2] float64 ymin,
                 [3] float64 ymax,
                 [4] class ApfelVS.complex Xn,
                 [5] class ApfelVS.complex C,
                 [6] int32 test,
                 [7] int32 x,
                 [8] int32 y,
                 [9] int32 counter,
                 [10] bool CS$4$0000)
        IL_0000:  nop
        IL_0001:  ldc.r8     -0.74546800000000002
        IL_000a:  stloc.0
        IL_000b:  ldc.r8     -0.74538499999999996
        IL_0014:  stloc.1
        IL_0015:  ldc.r8     0.11297500000000001
        IL_001e:  stloc.2
        IL_001f:  ldc.r8     0.11304400000000001
        IL_0028:  stloc.3
        IL_0029:  newobj     instance void ApfelVS.complex::.ctor()
        IL_002e:  stloc.s    Xn
        IL_0030:  newobj     instance void ApfelVS.complex::.ctor()
        IL_0035:  stloc.s    C
        IL_0037:  ldc.i4.0
        IL_0038:  stloc.s    test
        IL_003a:  ldc.i4.0
        IL_003b:  stloc.s    x
        IL_003d:  br         IL_0128
    
        IL_0042:  ldc.i4.0
        IL_0043:  stloc.s    y
        IL_0045:  br         IL_010d
    
        IL_004a:  nop
        IL_004b:  ldloc.s    C
        IL_004d:  ldloc.s    x
        IL_004f:  conv.r8
        IL_0050:  ldc.r8     1280.
        IL_0059:  div
        IL_005a:  ldloc.1
        IL_005b:  ldloc.0
        IL_005c:  sub
        IL_005d:  mul
        IL_005e:  ldloc.0
        IL_005f:  add
        IL_0060:  stfld      float64 ApfelVS.complex::real
        IL_0065:  ldloc.s    C
        IL_0067:  ldloc.s    y
        IL_0069:  conv.r8
        IL_006a:  ldc.r8     1024.
        IL_0073:  div
        IL_0074:  ldloc.3
        IL_0075:  ldloc.2
        IL_0076:  sub
        IL_0077:  mul
        IL_0078:  ldloc.2
        IL_0079:  add
        IL_007a:  stfld      float64 ApfelVS.complex::imag
        IL_007f:  ldloc.s    Xn
        IL_0081:  ldc.r8     0.0
        IL_008a:  stfld      float64 ApfelVS.complex::imag
        IL_008f:  ldloc.s    Xn
        IL_0091:  ldc.r8     0.0
        IL_009a:  stfld      float64 ApfelVS.complex::real
        IL_009f:  ldc.i4.0
        IL_00a0:  stloc.s    counter
        IL_00a2:  br.s       IL_00df
    
        IL_00a4:  nop
        IL_00a5:  ldloc.s    Xn
        IL_00a7:  ldloc.s    Xn
        IL_00a9:  call       class ApfelVS.complex ApfelVS.complex::op_Multiply(class ApfelVS.complex,
                                                                                class ApfelVS.complex)
        IL_00ae:  ldloc.s    C
        IL_00b0:  call       class ApfelVS.complex ApfelVS.complex::op_Addition(class ApfelVS.complex,
                                                                                class ApfelVS.complex)
        IL_00b5:  stloc.s    Xn
        IL_00b7:  ldloc.s    Xn
        IL_00b9:  callvirt   instance float64 ApfelVS.complex::betragsquadr()
        IL_00be:  ldc.r8     4.
        IL_00c7:  cgt
        IL_00c9:  ldc.i4.0
        IL_00ca:  ceq
        IL_00cc:  stloc.s    CS$4$0000
        IL_00ce:  ldloc.s    CS$4$0000
        IL_00d0:  brtrue.s   IL_00d8
    
        IL_00d2:  nop
        IL_00d3:  ldc.i4.1
        IL_00d4:  stloc.s    test
        IL_00d6:  br.s       IL_00f1
    
        IL_00d8:  nop
        IL_00d9:  ldloc.s    counter
        IL_00db:  ldc.i4.1
        IL_00dc:  add
        IL_00dd:  stloc.s    counter
        IL_00df:  ldloc.s    counter
        IL_00e1:  ldc.i4     0x1f4
        IL_00e6:  cgt
        IL_00e8:  ldc.i4.0
        IL_00e9:  ceq
        IL_00eb:  stloc.s    CS$4$0000
        IL_00ed:  ldloc.s    CS$4$0000
        IL_00ef:  brtrue.s   IL_00a4
    
        IL_00f1:  ldloc.s    test
        IL_00f3:  ldc.i4.0
        IL_00f4:  ceq
        IL_00f6:  ldc.i4.0
        IL_00f7:  ceq
        IL_00f9:  stloc.s    CS$4$0000
        IL_00fb:  ldloc.s    CS$4$0000
        IL_00fd:  brtrue.s   IL_0103
    
        IL_00ff:  nop
        IL_0100:  nop
        IL_0101:  br.s       IL_0106
    
        IL_0103:  ldc.i4.0
        IL_0104:  stloc.s    test
        IL_0106:  nop
        IL_0107:  ldloc.s    y
        IL_0109:  ldc.i4.1
        IL_010a:  add
        IL_010b:  stloc.s    y
        IL_010d:  ldloc.s    y
        IL_010f:  ldc.i4     0x400
        IL_0114:  cgt
        IL_0116:  ldc.i4.0
        IL_0117:  ceq
        IL_0119:  stloc.s    CS$4$0000
        IL_011b:  ldloc.s    CS$4$0000
        IL_011d:  brtrue     IL_004a
    
        IL_0122:  ldloc.s    x
        IL_0124:  ldc.i4.1
        IL_0125:  add
        IL_0126:  stloc.s    x
        IL_0128:  ldloc.s    x
        IL_012a:  ldc.i4     0x500
        IL_012f:  cgt
        IL_0131:  ldc.i4.0
        IL_0132:  ceq
        IL_0134:  stloc.s    CS$4$0000
        IL_0136:  ldloc.s    CS$4$0000
        IL_0138:  brtrue     IL_0042
    
        IL_013d:  ldstr      "Fertig"
        IL_0142:  call       void [mscorlib]System.Console::WriteLine(string)
        IL_0147:  nop
        IL_0148:  ret
      } // end of method Program::Main
    
      .method public hidebysig specialname rtspecialname 
              instance void  .ctor() cil managed
      {
        // Code size       7 (0x7)
        .maxstack  8
        IL_0000:  ldarg.0
        IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
        IL_0006:  ret
      } // end of method Program::.ctor
    
    } // end of class ApfelVS.Program
    
    .class public auto ansi beforefieldinit ApfelVS.complex
           extends [mscorlib]System.Object
    {
      .field public float64 imag
      .field public float64 real
      .method public hidebysig specialname static 
              class ApfelVS.complex  op_Addition(class ApfelVS.complex rhs,
                                                 class ApfelVS.complex lhs) cil managed
      {
        // Code size       51 (0x33)
        .maxstack  3
        .locals init ([0] class ApfelVS.complex result,
                 [1] class ApfelVS.complex CS$1$0000)
        IL_0000:  nop
        IL_0001:  newobj     instance void ApfelVS.complex::.ctor()
        IL_0006:  stloc.0
        IL_0007:  ldloc.0
        IL_0008:  ldarg.0
        IL_0009:  ldfld      float64 ApfelVS.complex::imag
        IL_000e:  ldarg.1
        IL_000f:  ldfld      float64 ApfelVS.complex::imag
        IL_0014:  add
        IL_0015:  stfld      float64 ApfelVS.complex::imag
        IL_001a:  ldloc.0
        IL_001b:  ldarg.0
        IL_001c:  ldfld      float64 ApfelVS.complex::real
        IL_0021:  ldarg.1
        IL_0022:  ldfld      float64 ApfelVS.complex::real
        IL_0027:  add
        IL_0028:  stfld      float64 ApfelVS.complex::real
        IL_002d:  ldloc.0
        IL_002e:  stloc.1
        IL_002f:  br.s       IL_0031
    
        IL_0031:  ldloc.1
        IL_0032:  ret
      } // end of method complex::op_Addition
    
      .method public hidebysig specialname static 
              class ApfelVS.complex  op_Multiply(class ApfelVS.complex rhs,
                                                 class ApfelVS.complex lhs) cil managed
      {
        // Code size       79 (0x4f)
        .maxstack  4
        .locals init ([0] class ApfelVS.complex result,
                 [1] class ApfelVS.complex CS$1$0000)
        IL_0000:  nop
        IL_0001:  newobj     instance void ApfelVS.complex::.ctor()
        IL_0006:  stloc.0
        IL_0007:  ldloc.0
        IL_0008:  ldarg.0
        IL_0009:  ldfld      float64 ApfelVS.complex::real
        IL_000e:  ldarg.1
        IL_000f:  ldfld      float64 ApfelVS.complex::real
        IL_0014:  mul
        IL_0015:  ldarg.0
        IL_0016:  ldfld      float64 ApfelVS.complex::imag
        IL_001b:  ldarg.1
        IL_001c:  ldfld      float64 ApfelVS.complex::imag
        IL_0021:  mul
        IL_0022:  sub
        IL_0023:  stfld      float64 ApfelVS.complex::real
        IL_0028:  ldloc.0
        IL_0029:  ldarg.0
        IL_002a:  ldfld      float64 ApfelVS.complex::real
        IL_002f:  ldarg.1
        IL_0030:  ldfld      float64 ApfelVS.complex::imag
        IL_0035:  mul
        IL_0036:  ldarg.0
        IL_0037:  ldfld      float64 ApfelVS.complex::imag
        IL_003c:  ldarg.1
        IL_003d:  ldfld      float64 ApfelVS.complex::real
        IL_0042:  mul
        IL_0043:  add
        IL_0044:  stfld      float64 ApfelVS.complex::imag
        IL_0049:  ldloc.0
        IL_004a:  stloc.1
        IL_004b:  br.s       IL_004d
    
        IL_004d:  ldloc.1
        IL_004e:  ret
      } // end of method complex::op_Multiply
    
      .method public hidebysig instance float64 
              betragsquadr() cil managed
      {
        // Code size       33 (0x21)
        .maxstack  3
        .locals init ([0] float64 CS$1$0000)
        IL_0000:  nop
        IL_0001:  ldarg.0
        IL_0002:  ldfld      float64 ApfelVS.complex::imag
        IL_0007:  ldarg.0
        IL_0008:  ldfld      float64 ApfelVS.complex::imag
        IL_000d:  mul
        IL_000e:  ldarg.0
        IL_000f:  ldfld      float64 ApfelVS.complex::real
        IL_0014:  ldarg.0
        IL_0015:  ldfld      float64 ApfelVS.complex::real
        IL_001a:  mul
        IL_001b:  add
        IL_001c:  stloc.0
        IL_001d:  br.s       IL_001f
    
        IL_001f:  ldloc.0
        IL_0020:  ret
      } // end of method complex::betragsquadr
    
      .method public hidebysig specialname rtspecialname 
              instance void  .ctor() cil managed
      {
        // Code size       7 (0x7)
        .maxstack  8
        IL_0000:  ldarg.0
        IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
        IL_0006:  ret
      } // end of method complex::.ctor
    
    } // end of class ApfelVS.complex
    
    // =============================================================
    
    // *********** DISASSEMBLY COMPLETE ***********************
    // WARNING: Created Win32 resource file H:\Eigene Dateien\EigeneProgs\C#\ApfelVS\ApfelVS\bin\Debug\VSApfel.res
    


  • 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.


Anmelden zum Antworten