Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. In .NET enumeration is slow

In .NET enumeration is slow

Scheduled Pinned Locked Moved The Lounge
csharpdesignlinqcomgraphics
52 Posts 13 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H honey the codewitch

    That's great for your situation. In my current scenario this code was generated by a tool, and specifically designed to be able to produce dependency free code. I might actually consider the facade idea though for when it is opted to rely on the runtimes - right now the VB code can't under the newer frameworks unless you turn off spans in the compiled runtime itself - the build - not at runtime - it's conditionally compiled in. So that facade may fix that issue. And yet otherwise in my tests, the spanless string approach i use (Substring instead of Splice) doesn't yield noticeably less performance. That leads me to suspect I'm not using it to its fullest - an encouraging thought in the big picture because it means I can get even more speed out of it. I'm not sure that's possible though because no matter how I think about approaching it a copy is always necessary by the time you hit the Value property off FAMatch. It's a head scratcher.

    Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

    Graeme_GrantG Offline
    Graeme_GrantG Offline
    Graeme_Grant
    wrote on last edited by
    #23

    Quote:

    And yet otherwise in my tests, the spanless string approach i use (Substring instead of Splice) doesn't yield noticeably less performance. That leads me to suspect I'm not using it to its fullest - an encouraging thought in the big picture because it means I can get even more speed out of it. I'm not sure that's possible though because no matter how I think about approaching it a copy is always necessary by the time you hit the Value property off FAMatch. It's a head scratcher.

    Without knowing specifics, it is difficult to comment. That article is about dealing with gigabytes of data using streams efficiently keeping allocations to a minimum. There was a lot of research, trial & error done to find the best optimal solution. I even looked at the source code of Microsoft's latest (At the time) .Net Core. Renting ReadOnlyMemory[^] was not suitable as all memory blocks needed to be of the same size otherwise nulls fill the gaps. This is not documented anywhere! And I did look. That was a real headscratcher at the time. Don't get me started on ref strut in an asynchronous environment... I'm sure if you take a step back, do a bit of research, experimenting, digging into the Microsoft code, you will find a solution.

    Graeme


    "I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee

    H 1 Reply Last reply
    0
    • Graeme_GrantG Graeme_Grant

      Quote:

      And yet otherwise in my tests, the spanless string approach i use (Substring instead of Splice) doesn't yield noticeably less performance. That leads me to suspect I'm not using it to its fullest - an encouraging thought in the big picture because it means I can get even more speed out of it. I'm not sure that's possible though because no matter how I think about approaching it a copy is always necessary by the time you hit the Value property off FAMatch. It's a head scratcher.

      Without knowing specifics, it is difficult to comment. That article is about dealing with gigabytes of data using streams efficiently keeping allocations to a minimum. There was a lot of research, trial & error done to find the best optimal solution. I even looked at the source code of Microsoft's latest (At the time) .Net Core. Renting ReadOnlyMemory[^] was not suitable as all memory blocks needed to be of the same size otherwise nulls fill the gaps. This is not documented anywhere! And I did look. That was a real headscratcher at the time. Don't get me started on ref strut in an asynchronous environment... I'm sure if you take a step back, do a bit of research, experimenting, digging into the Microsoft code, you will find a solution.

      Graeme


      "I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee

      H Offline
      H Offline
      honey the codewitch
      wrote on last edited by
      #24

      I feel like it might be chasing ghosts, particularly since I already get really great performance out of the thing, especially compared to .NET Regex even though that always uses ReadOnlySpan. I still beat it by 3x in the best case.

      Microsoft Regex "Lexer": [■■■■■■■■■■] 100% Found 220000 matches in 35ms
      Microsoft Regex compiled "Lexer": [■■■■■■■■■■] 100% Found 220000 matches in 20ms
      FAStringRunner (proto): [■■■■■■■■■■] 100% Found 220000 matches in 7ms
      FATextReaderRunner: (proto) [■■■■■■■■■■] 100% Found 220000 matches in 13ms
      FAStringDfaTableRunner: [■■■■■■■■■■] 100% Found 220000 matches in 10ms
      FATextReaderDfaTableRunner: [■■■■■■■■■■] 100% Found 220000 matches in 14ms
      FAStringStateRunner (NFA): [■■■■■■■■■■] 100% Found 220000 matches in 145ms
      FAStringStateRunner (Compact NFA): [■■■■■■■■■■] 100% Found 220000 matches in 43ms
      FATextReaderStateRunner (Compact NFA): [■■■■■■■■■■] 100% Found 220000 matches in 48ms
      FAStringStateRunner (DFA): [■■■■■■■■■■] 100% Found 220000 matches in 11ms
      FATextReaderStateRunner (DFA): [■■■■■■■■■■] 100% Found 220000 matches in 16ms
      FAStringRunner (Compiled): [■■■■■■■■■■] 100% Found 220000 matches in 7ms
      FATextReaderRunner (Compiled): [■■■■■■■■■■] 100% Found 220000 matches in 12ms

      7ms is about what I get compared to microsoft's 20 if I'm making the fairest comparison possible (apples vs apples) 'cept mine doesn't backtrack or support a bunch of fluff. (though it lacks anchors :( ) If I can't get another 10% out of this I don't think it's worth the trouble.

      Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

      Graeme_GrantG 1 Reply Last reply
      0
      • H honey the codewitch

        I feel like it might be chasing ghosts, particularly since I already get really great performance out of the thing, especially compared to .NET Regex even though that always uses ReadOnlySpan. I still beat it by 3x in the best case.

        Microsoft Regex "Lexer": [■■■■■■■■■■] 100% Found 220000 matches in 35ms
        Microsoft Regex compiled "Lexer": [■■■■■■■■■■] 100% Found 220000 matches in 20ms
        FAStringRunner (proto): [■■■■■■■■■■] 100% Found 220000 matches in 7ms
        FATextReaderRunner: (proto) [■■■■■■■■■■] 100% Found 220000 matches in 13ms
        FAStringDfaTableRunner: [■■■■■■■■■■] 100% Found 220000 matches in 10ms
        FATextReaderDfaTableRunner: [■■■■■■■■■■] 100% Found 220000 matches in 14ms
        FAStringStateRunner (NFA): [■■■■■■■■■■] 100% Found 220000 matches in 145ms
        FAStringStateRunner (Compact NFA): [■■■■■■■■■■] 100% Found 220000 matches in 43ms
        FATextReaderStateRunner (Compact NFA): [■■■■■■■■■■] 100% Found 220000 matches in 48ms
        FAStringStateRunner (DFA): [■■■■■■■■■■] 100% Found 220000 matches in 11ms
        FATextReaderStateRunner (DFA): [■■■■■■■■■■] 100% Found 220000 matches in 16ms
        FAStringRunner (Compiled): [■■■■■■■■■■] 100% Found 220000 matches in 7ms
        FATextReaderRunner (Compiled): [■■■■■■■■■■] 100% Found 220000 matches in 12ms

        7ms is about what I get compared to microsoft's 20 if I'm making the fairest comparison possible (apples vs apples) 'cept mine doesn't backtrack or support a bunch of fluff. (though it lacks anchors :( ) If I can't get another 10% out of this I don't think it's worth the trouble.

        Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

        Graeme_GrantG Offline
        Graeme_GrantG Offline
        Graeme_Grant
        wrote on last edited by
        #25

        That is impressive. Have you seen the latest updates to RegEx? Regular Expression Improvements in .NET 7 - .NET Blog[^] ... Source Generators for RegEx are next level! I would dig into the source code for the changes to the RegEx and the Source Generator for RegEx and see how they do it to get ideas for yours.

        Quote:

        If I can't get another 10% out of this I don't think it's worth the trouble.

        I hear you, and for a one-off can agree, however, you will need to understand that last 10% for future projects. The question is now or then?

        Graeme


        "I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee

        H 2 Replies Last reply
        0
        • Graeme_GrantG Graeme_Grant

          That is impressive. Have you seen the latest updates to RegEx? Regular Expression Improvements in .NET 7 - .NET Blog[^] ... Source Generators for RegEx are next level! I would dig into the source code for the changes to the RegEx and the Source Generator for RegEx and see how they do it to get ideas for yours.

          Quote:

          If I can't get another 10% out of this I don't think it's worth the trouble.

          I hear you, and for a one-off can agree, however, you will need to understand that last 10% for future projects. The question is now or then?

          Graeme


          "I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee

          H Offline
          H Offline
          honey the codewitch
          wrote on last edited by
          #26

          That's actually targeting Microsoft's .NET 7 implementation, and yeah I've looked at their source generator and considered making my own using the same tech. Right now I'm using the CodeDOM for that, which is older, but doesn't require near as much buy in in terms of your install base. For instance, you don't need compiler services running, and I'm not even sure how compatible it is with DNF and there are other unknowns. I need to do more research. I actually did dotNetPeek them which is how I figured out the Span stuff. I don't like their code. Frankly, I'm impressed with the code-synthesis but they still made it hard to follow, and I'm not sure if that's so beneficial. My code looks machine generated, but it's easy to follow, as state machines go:

          // Matches C line comments or block comments
          private FAMatch _BlockEnd0(ReadOnlySpan s, int cp, int len, int position, int line, int column) {
          q0:
          // [\*]
          if ((cp == 42)) {
          this.Advance(s, ref cp, ref len, false);
          goto q1;
          }
          goto errorout;
          q1:
          // [\/]
          if ((cp == 47)) {
          this.Advance(s, ref cp, ref len, false);
          goto q2;
          }
          goto errorout;
          q2:
          return FAMatch.Create(0, s.Slice(position, len).ToString(), position, line, column);
          errorout:
          if ((cp == -1)) {
          return FAMatch.Create(-1, s.Slice(position, len).ToString(), position, line, column);
          }
          this.Advance(s, ref cp, ref len, false);
          goto q0;
          }
          private FAMatch NextMatchImpl(ReadOnlySpan s) {
          int ch;
          int len;
          int p;
          int l;
          int c;
          ch = -1;
          len = 0;
          if ((this.position == -1)) {
          this.position = 0;
          }
          p = this.position;
          l = this.line;
          c = this.column;
          this.Advance(s, ref ch, ref len, true);
          // q0:
          // [\/]
          if ((ch == 47)) {
          this.Advance(s, ref ch, ref len, false);
          goto q1;
          }
          goto errorout;
          q1:
          // [\*]
          if ((ch == 42)) {
          this.Advance(s, ref ch, ref len, false);
          goto q2;
          }
          goto errorout;
          q2:
          return _BlockEnd0(s, ch, len, p, l, c);
          errorout:
          if (((ch == -1)
          || (ch == 47))) {
          if ((len == 0)) {
          return FAMatch.Create(-2, null, 0, 0, 0);
          }
          return FAMatch.Create(-1, s.Slice(p, len).ToString(), p, l, c);
          }
          this.Advance(s, ref ch, ref len, false);
          goto errorout;
          }

          Main thing that makes it tough is the use of UTF-32 codepoints instead of chars - neces

          Graeme_GrantG 1 Reply Last reply
          0
          • Graeme_GrantG Graeme_Grant

            That is impressive. Have you seen the latest updates to RegEx? Regular Expression Improvements in .NET 7 - .NET Blog[^] ... Source Generators for RegEx are next level! I would dig into the source code for the changes to the RegEx and the Source Generator for RegEx and see how they do it to get ideas for yours.

            Quote:

            If I can't get another 10% out of this I don't think it's worth the trouble.

            I hear you, and for a one-off can agree, however, you will need to understand that last 10% for future projects. The question is now or then?

            Graeme


            "I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee

            H Offline
            H Offline
            honey the codewitch
            wrote on last edited by
            #27

            I missed the bottom line of your post. I'll respond here. Well, this 10% is for a library, so it kind of changes the calculus of it somewhat. The 10% has a multiplier effect based on how popular the library gets, if that makes sense. I don't think the 10% would make the code that much more confusing unless it also forces me to do something to it I am unwilling to anyway. I am not looking for a total remodel at this stage given the stability and performance numbers I have.

            Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

            1 Reply Last reply
            0
            • H honey the codewitch

              That's actually targeting Microsoft's .NET 7 implementation, and yeah I've looked at their source generator and considered making my own using the same tech. Right now I'm using the CodeDOM for that, which is older, but doesn't require near as much buy in in terms of your install base. For instance, you don't need compiler services running, and I'm not even sure how compatible it is with DNF and there are other unknowns. I need to do more research. I actually did dotNetPeek them which is how I figured out the Span stuff. I don't like their code. Frankly, I'm impressed with the code-synthesis but they still made it hard to follow, and I'm not sure if that's so beneficial. My code looks machine generated, but it's easy to follow, as state machines go:

              // Matches C line comments or block comments
              private FAMatch _BlockEnd0(ReadOnlySpan s, int cp, int len, int position, int line, int column) {
              q0:
              // [\*]
              if ((cp == 42)) {
              this.Advance(s, ref cp, ref len, false);
              goto q1;
              }
              goto errorout;
              q1:
              // [\/]
              if ((cp == 47)) {
              this.Advance(s, ref cp, ref len, false);
              goto q2;
              }
              goto errorout;
              q2:
              return FAMatch.Create(0, s.Slice(position, len).ToString(), position, line, column);
              errorout:
              if ((cp == -1)) {
              return FAMatch.Create(-1, s.Slice(position, len).ToString(), position, line, column);
              }
              this.Advance(s, ref cp, ref len, false);
              goto q0;
              }
              private FAMatch NextMatchImpl(ReadOnlySpan s) {
              int ch;
              int len;
              int p;
              int l;
              int c;
              ch = -1;
              len = 0;
              if ((this.position == -1)) {
              this.position = 0;
              }
              p = this.position;
              l = this.line;
              c = this.column;
              this.Advance(s, ref ch, ref len, true);
              // q0:
              // [\/]
              if ((ch == 47)) {
              this.Advance(s, ref ch, ref len, false);
              goto q1;
              }
              goto errorout;
              q1:
              // [\*]
              if ((ch == 42)) {
              this.Advance(s, ref ch, ref len, false);
              goto q2;
              }
              goto errorout;
              q2:
              return _BlockEnd0(s, ch, len, p, l, c);
              errorout:
              if (((ch == -1)
              || (ch == 47))) {
              if ((len == 0)) {
              return FAMatch.Create(-2, null, 0, 0, 0);
              }
              return FAMatch.Create(-1, s.Slice(p, len).ToString(), p, l, c);
              }
              this.Advance(s, ref ch, ref len, false);
              goto errorout;
              }

              Main thing that makes it tough is the use of UTF-32 codepoints instead of chars - neces

              Graeme_GrantG Offline
              Graeme_GrantG Offline
              Graeme_Grant
              wrote on last edited by
              #28

              Quote:

              I actually did dotNetPeek them

              In my experience, I have found peeking and looking at the actual source code is not always the same thing. The compiler tends to optimise and rewrite code these days...

              Graeme


              "I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee

              H 1 Reply Last reply
              0
              • Graeme_GrantG Graeme_Grant

                Quote:

                I actually did dotNetPeek them

                In my experience, I have found peeking and looking at the actual source code is not always the same thing. The compiler tends to optimise and rewrite code these days...

                Graeme


                "I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee

                H Offline
                H Offline
                honey the codewitch
                wrote on last edited by
                #29

                In that case I wasn't as interested in the source code as I was in the final code. I was looking for optimization opportunities, and I was looking at the IL as well and comparing it to mine.

                Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                1 Reply Last reply
                0
                • H honey the codewitch

                  It's not 20ms. it's a 30% improvement in overall execution time. If I increase the test size to run for 90 seconds, it would run for about 60 after the optimization. If you get even 20% off the execution in critical code paths it's generally worth the optimization. I mean, of course it depends on the circumstances, and is less true of business development, or development with large teams or teams with with a lot of turnover, where you can't afford the additional maintenance overhead, limited knowledge transferability and cognitive load of optimized code. That is not a microoptimization. 30% off total execution time is a significant savings. Adding, I used to use garbage collection in my ISAPI applications because it prevented nasty heap fragmentation due to all the string processing required of web servers. It made things faster. GC isn't always a losing performance proposition. When the situation calls for it, it can increase overall performance.

                  Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #30

                  30% in overall execution time? Does your code consist mostly of enumerations and while loops? No, it doesn't go from 90 to 60, unless all your code is enumerate. Real world code is more than just retrieving a list. Sorry Honey. VS shows you the place where it spends most time. "Limited knowledge trans...", aight, you're allowed to your views, I have mine. And yes, mucking about a for loop vs enumerable in an VB6 runtime (which .NET IS) is not even a microoptimization, it is purely whining. Write in a goddamn real language if it is that important an link to it from .NET where you need it. You have fallen, my angel, and very deep. Time critical stuff isn't worth .NET, and it isn't worth my time to read about 20 ms savings in a different loop that is less readable. When the situation calls for it, you want someone who works with pointers, not with .NET. I would write a library for you to link to that does the heavy lifting, "if the situation calls for it". Because .NET is just an evolution of VB6, it is just a runtime interpreting with a memory manager. It is vbruntime600 with additional libraries. Any compiled language with pointers laughs out loud. This is not even an argument honey. EVERYONE can use a profiler and see how much your micro optimization may help them. If it does, then yay for them for writing ineffcient code. My code does not consist of merely enumerations, it deals with a lot more stuff. Real world code consist of more than "looping". And if speed is that paramount then why are you using .NET? Are you really blabbing about how to do a for loop in a VB-variant? That is what C# is, VB6 in a new interface, but that translates 1 on 1 to VB. You really whining about the performance of BASIC code (by any other syntax, but still a rose/VB)? And you prove it by throwing some unreadable code, that saves me 20 ms? That is going to impress, really. You will shave of some ms, sacrificing readability for some code that takes more than 2 secs? Did you know that humans only see 48 frames per second? The END USER will not even notice, but the manager that pays someone to update your code WILL. You're gonna go far kid.

                  Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                  H 1 Reply Last reply
                  0
                  • P PIEBALDconsult

                    Welcome to my bandwagon. I've been saying this for ages. Don't use foreach unless you have to -- or where it doesn't matter. Having said that... I hypothesize that foreach has improved. To test this hypothesis, last summer (?) I was testing and measuring some comparisons and I didn't see much difference. I was unable to form conclusions at that time because I wasn't convinced that the tests were valid. I'll have another look later. P.S. And besides, you mean iteration, not enumeration -- I blame Microsoft for misnaming the thing.

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #31

                    You "think"? We do not think, we measure. If you say that you think, you think that you think. Measure or shut the elephant op.

                    Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                    1 Reply Last reply
                    0
                    • D Dave Kreskowiak

                      Of course it's slower. The IEnumerable interface expects a class with methods you have to call to maintain which item in the IEnumerable implementor you're looking at. Calling methods adds overhead, and plenty of it compared to the overhead of an index variable, which you know is just pointer math. Enumerable being slower is not surprising at all. Just don't use it where you don't have to, and that includes LINQ because it's heavily dependent on the IEnumerable interfaces.

                      Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #32

                      Upvoted and sorry. It is a decision. Do you want the best in speed? Or do you just need to get things done and be readable?

                      Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                      1 Reply Last reply
                      0
                      • L Lost User

                        30% in overall execution time? Does your code consist mostly of enumerations and while loops? No, it doesn't go from 90 to 60, unless all your code is enumerate. Real world code is more than just retrieving a list. Sorry Honey. VS shows you the place where it spends most time. "Limited knowledge trans...", aight, you're allowed to your views, I have mine. And yes, mucking about a for loop vs enumerable in an VB6 runtime (which .NET IS) is not even a microoptimization, it is purely whining. Write in a goddamn real language if it is that important an link to it from .NET where you need it. You have fallen, my angel, and very deep. Time critical stuff isn't worth .NET, and it isn't worth my time to read about 20 ms savings in a different loop that is less readable. When the situation calls for it, you want someone who works with pointers, not with .NET. I would write a library for you to link to that does the heavy lifting, "if the situation calls for it". Because .NET is just an evolution of VB6, it is just a runtime interpreting with a memory manager. It is vbruntime600 with additional libraries. Any compiled language with pointers laughs out loud. This is not even an argument honey. EVERYONE can use a profiler and see how much your micro optimization may help them. If it does, then yay for them for writing ineffcient code. My code does not consist of merely enumerations, it deals with a lot more stuff. Real world code consist of more than "looping". And if speed is that paramount then why are you using .NET? Are you really blabbing about how to do a for loop in a VB-variant? That is what C# is, VB6 in a new interface, but that translates 1 on 1 to VB. You really whining about the performance of BASIC code (by any other syntax, but still a rose/VB)? And you prove it by throwing some unreadable code, that saves me 20 ms? That is going to impress, really. You will shave of some ms, sacrificing readability for some code that takes more than 2 secs? Did you know that humans only see 48 frames per second? The END USER will not even notice, but the manager that pays someone to update your code WILL. You're gonna go far kid.

                        Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                        H Offline
                        H Offline
                        honey the codewitch
                        wrote on last edited by
                        #33

                        > 30% in overall execution time? Does your code consist mostly of enumerations and while loops? In this case yes, in fact I posted the code, which is a regex matching algorithm. > And yes, mucking about a for loop vs enumerable in an VB6 runtime (which .NET IS) is not even a microoptimization, it is purely whining. Write in a goddamn real language if it is that important an link to it from .NET where you need it. I wasn't whining. I was making an observation. You're looking for a fight. I have better things to do with my time. Grow up. Also VB.NET and VB6 runtimes have nothing to do with each other. You don't even know what you're talking about. Funny how arrogance and ignorance go hand in hand so often.

                        Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                        L O 2 Replies Last reply
                        0
                        • H honey the codewitch

                          It's not 20ms. it's a 30% improvement in overall execution time. If I increase the test size to run for 90 seconds, it would run for about 60 after the optimization. If you get even 20% off the execution in critical code paths it's generally worth the optimization. I mean, of course it depends on the circumstances, and is less true of business development, or development with large teams or teams with with a lot of turnover, where you can't afford the additional maintenance overhead, limited knowledge transferability and cognitive load of optimized code. That is not a microoptimization. 30% off total execution time is a significant savings. Adding, I used to use garbage collection in my ISAPI applications because it prevented nasty heap fragmentation due to all the string processing required of web servers. It made things faster. GC isn't always a losing performance proposition. When the situation calls for it, it can increase overall performance.

                          Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #34

                          Any other day, this would go. Today is not that day. It isn't 30% even if all you do is enumerate. GC's is losing performance by definition of what the beast is made of. Show me one example of .NET that outperforms Delphi? Where, o where, would an interpreter with a lot of libraries outperform a compiled native language? You .NET dev? Than you write in VB7, complete with a GC and a runtime interpreter. Your code will be faster than anything I write in a real compiler, innit? And your 20 ms on 60 is gonna make a 30% if it is only enumerating, because all that code does is enumerate. I am not even amused a bit. Obfuscation to save a few ms. Yeah, that will help, really. You saved the world, but the rest of us are going to use enumerations because it is a damned good tradeof for those that only know .NET and cannot handle pointers. It makes code readable, which yours damned ain't. Great, you reduced some code by 20 ms. Most code takes longer. Was there anything else you'd like to whine about, or are we done? :| BPFH :suss:

                          Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                          1 Reply Last reply
                          0
                          • H honey the codewitch

                            > 30% in overall execution time? Does your code consist mostly of enumerations and while loops? In this case yes, in fact I posted the code, which is a regex matching algorithm. > And yes, mucking about a for loop vs enumerable in an VB6 runtime (which .NET IS) is not even a microoptimization, it is purely whining. Write in a goddamn real language if it is that important an link to it from .NET where you need it. I wasn't whining. I was making an observation. You're looking for a fight. I have better things to do with my time. Grow up. Also VB.NET and VB6 runtimes have nothing to do with each other. You don't even know what you're talking about. Funny how arrogance and ignorance go hand in hand so often.

                            Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                            L Offline
                            L Offline
                            Lost User
                            wrote on last edited by
                            #35

                            A fringe case, as most of us do not write regex-libs, and anyone who would doesn't use an interpreter but a compiler. No, not a byte code compiler, that's just a fancy marketing shit for an interpreter that doesn't compile to native. And yes, I'm looking for a fight; you are implying that some loop in an interpreter is interesting. It isn't. VB.NET and VB6 are ridiculously the same. I've done that discussion a thousand times, where a manager imagined C# to be superior to VB.NET. It is a different syntax for the same VBRUN300.DLL, a fakkin interpreter that does bytecode like VB6 did with the same memory manager. C# is marketing, but under the hood it is just VB7 with a different style of writing. Which is brilliant from an MS perspective btw, which proves MS is still the best. Now, get off my lawn.

                            Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                            H J 2 Replies Last reply
                            0
                            • L Lost User

                              A fringe case, as most of us do not write regex-libs, and anyone who would doesn't use an interpreter but a compiler. No, not a byte code compiler, that's just a fancy marketing shit for an interpreter that doesn't compile to native. And yes, I'm looking for a fight; you are implying that some loop in an interpreter is interesting. It isn't. VB.NET and VB6 are ridiculously the same. I've done that discussion a thousand times, where a manager imagined C# to be superior to VB.NET. It is a different syntax for the same VBRUN300.DLL, a fakkin interpreter that does bytecode like VB6 did with the same memory manager. C# is marketing, but under the hood it is just VB7 with a different style of writing. Which is brilliant from an MS perspective btw, which proves MS is still the best. Now, get off my lawn.

                              Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                              H Offline
                              H Offline
                              honey the codewitch
                              wrote on last edited by
                              #36

                              Linq makes it not a fringe case since it uses enumerations all over the place. It's also a known documented issue with .NET. I'm far from the first person to make this observation. Folks from Microsoft have said as much. And yes, you're looking for a fight. I'm an adult, which is why I was looking for a discussion. You're clearly not capable of something like that so we're done. Feel free to keep running your mouth about .NET, in case anyone wasn't already convinced that you don't know half of what you're on about.

                              Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                              L 1 Reply Last reply
                              0
                              • H honey the codewitch

                                Linq makes it not a fringe case since it uses enumerations all over the place. It's also a known documented issue with .NET. I'm far from the first person to make this observation. Folks from Microsoft have said as much. And yes, you're looking for a fight. I'm an adult, which is why I was looking for a discussion. You're clearly not capable of something like that so we're done. Feel free to keep running your mouth about .NET, in case anyone wasn't already convinced that you don't know half of what you're on about.

                                Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                                L Offline
                                L Offline
                                Lost User
                                wrote on last edited by
                                #37

                                Quote:

                                Linq makes it not a fringe case since it uses enumerations all over the place.

                                You disliked Linq? Normal code doesn't require Linq? Did you make this microoptimization to prove you're better than Linq?

                                Quote:

                                It's also a known documented issue with .NET. I'm far from the first person to make this observation. Folks from Microsoft have said as much.

                                Is that the basis of your post? Maybe you missed the point; 20 ms is nothing in a background thread, and I would remove your code from any codebase for being unreadable and obfuscating. I gladly pay a few ms for readability, maintenance and fewer bugs. That is implying that there's only .NET devs and that there's no person available who can write in a language that compiles to native. You call those things "libraries".

                                Quote:

                                And yes, you're looking for a fight. I'm an adult, which is why I was looking for a discussion. You're clearly not capable of something like that so we're done.

                                So, that is your defense? You little twat copied MS and you can't handle me saying it ain't so? Thank you for the limitless list of arguments and examples. Wait, there's none? "Folks from MS have said".. and you copied and try to impress. Sorry, but you didn't with your 20 ms. As if all code is a regex-lookup, which you present as if your micro optimization invalidates every foreach. If you want to regex, use a native language. I will BREAK your nonsense. I do not care about you copying MS and presenting it as "your" observation. I just puke over the generalization :suss:

                                Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                                H 2 Replies Last reply
                                0
                                • L Lost User

                                  Quote:

                                  Linq makes it not a fringe case since it uses enumerations all over the place.

                                  You disliked Linq? Normal code doesn't require Linq? Did you make this microoptimization to prove you're better than Linq?

                                  Quote:

                                  It's also a known documented issue with .NET. I'm far from the first person to make this observation. Folks from Microsoft have said as much.

                                  Is that the basis of your post? Maybe you missed the point; 20 ms is nothing in a background thread, and I would remove your code from any codebase for being unreadable and obfuscating. I gladly pay a few ms for readability, maintenance and fewer bugs. That is implying that there's only .NET devs and that there's no person available who can write in a language that compiles to native. You call those things "libraries".

                                  Quote:

                                  And yes, you're looking for a fight. I'm an adult, which is why I was looking for a discussion. You're clearly not capable of something like that so we're done.

                                  So, that is your defense? You little twat copied MS and you can't handle me saying it ain't so? Thank you for the limitless list of arguments and examples. Wait, there's none? "Folks from MS have said".. and you copied and try to impress. Sorry, but you didn't with your 20 ms. As if all code is a regex-lookup, which you present as if your micro optimization invalidates every foreach. If you want to regex, use a native language. I will BREAK your nonsense. I do not care about you copying MS and presenting it as "your" observation. I just puke over the generalization :suss:

                                  Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                                  H Offline
                                  H Offline
                                  honey the codewitch
                                  wrote on last edited by
                                  #38

                                  *sigh* You're a child. And you can't even code in C or C++. Stop wagging your tiny little peen around like it's something. :laugh:

                                  Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                                  1 Reply Last reply
                                  0
                                  • L Lost User

                                    Quote:

                                    Linq makes it not a fringe case since it uses enumerations all over the place.

                                    You disliked Linq? Normal code doesn't require Linq? Did you make this microoptimization to prove you're better than Linq?

                                    Quote:

                                    It's also a known documented issue with .NET. I'm far from the first person to make this observation. Folks from Microsoft have said as much.

                                    Is that the basis of your post? Maybe you missed the point; 20 ms is nothing in a background thread, and I would remove your code from any codebase for being unreadable and obfuscating. I gladly pay a few ms for readability, maintenance and fewer bugs. That is implying that there's only .NET devs and that there's no person available who can write in a language that compiles to native. You call those things "libraries".

                                    Quote:

                                    And yes, you're looking for a fight. I'm an adult, which is why I was looking for a discussion. You're clearly not capable of something like that so we're done.

                                    So, that is your defense? You little twat copied MS and you can't handle me saying it ain't so? Thank you for the limitless list of arguments and examples. Wait, there's none? "Folks from MS have said".. and you copied and try to impress. Sorry, but you didn't with your 20 ms. As if all code is a regex-lookup, which you present as if your micro optimization invalidates every foreach. If you want to regex, use a native language. I will BREAK your nonsense. I do not care about you copying MS and presenting it as "your" observation. I just puke over the generalization :suss:

                                    Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                                    H Offline
                                    H Offline
                                    honey the codewitch
                                    wrote on last edited by
                                    #39

                                    You seriously called me a "twat"? What the hell is wrong with you? You are a child. You can't even code in C or C++, and you talk about Delphi like that's a flex. It's a joke. You're a joke, and you're a belligerent clown. I've reported your account because this isn't the first time you've been abusive and hostile to other people.

                                    Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                                    L 1 Reply Last reply
                                    0
                                    • H honey the codewitch

                                      You seriously called me a "twat"? What the hell is wrong with you? You are a child. You can't even code in C or C++, and you talk about Delphi like that's a flex. It's a joke. You're a joke, and you're a belligerent clown. I've reported your account because this isn't the first time you've been abusive and hostile to other people.

                                      Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                                      L Offline
                                      L Offline
                                      Lost User
                                      wrote on last edited by
                                      #40

                                      Quote:

                                      I've reported your account because this isn't the first time you've been abusive and hostile to other people.

                                      I cannot argue that, as it is true. I do not have much patience.

                                      Quote:

                                      You are a child

                                      You meant "childish". :suss:

                                      Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                                      H M 2 Replies Last reply
                                      0
                                      • L Lost User

                                        Quote:

                                        I've reported your account because this isn't the first time you've been abusive and hostile to other people.

                                        I cannot argue that, as it is true. I do not have much patience.

                                        Quote:

                                        You are a child

                                        You meant "childish". :suss:

                                        Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                                        H Offline
                                        H Offline
                                        honey the codewitch
                                        wrote on last edited by
                                        #41

                                        I would have been happy to debate this with you. That changed when it became clear to me that weren't interested in actually debating anyone. You came here for a fight. You came here because you wanted to abuse other people. You have some issues, and you are making them the problem of other people here. That's not cool.

                                        Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                                        1 Reply Last reply
                                        0
                                        • H honey the codewitch

                                          > 30% in overall execution time? Does your code consist mostly of enumerations and while loops? In this case yes, in fact I posted the code, which is a regex matching algorithm. > And yes, mucking about a for loop vs enumerable in an VB6 runtime (which .NET IS) is not even a microoptimization, it is purely whining. Write in a goddamn real language if it is that important an link to it from .NET where you need it. I wasn't whining. I was making an observation. You're looking for a fight. I have better things to do with my time. Grow up. Also VB.NET and VB6 runtimes have nothing to do with each other. You don't even know what you're talking about. Funny how arrogance and ignorance go hand in hand so often.

                                          Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                                          O Offline
                                          O Offline
                                          obermd
                                          wrote on last edited by
                                          #42

                                          Regex, now there's your real problem. :laugh: [xkcd: Perl Problems](https://xkcd.com/1171/)

                                          T 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups