Jonkman Microblog
  • Login
Show Navigation
  • Public

    • Public
    • Network
    • Groups
    • Popular
    • People

Conversation

Notices

  1. Mister M. T. Sack (thatbrickster@shitposter.club)'s status on Tuesday, 06-Feb-2018 12:30:09 EST Mister M. T. Sack Mister M. T. Sack
    TIL pre-crement is faster than post-crement but probably doesn't matter to the .Net compiler. Also, counting to zero for loops is slightly quicker than counting up.
    In conversation Tuesday, 06-Feb-2018 12:30:09 EST from shitposter.club permalink
    1. ay (ayy@gs.smuglo.li)'s status on Tuesday, 06-Feb-2018 12:35:27 EST ay ay
      in reply to
      @thatbrickster Yeah counting to zero you can use the "loop" assembly instruction, assuming the rcx register is available. I think the difference should be pretty marginal though, as I've almost never seen anyone tdo it.

      Assuming dot net works like C++, pre vs post increment shouldn't matter for builtin types, only for non-builtin ones that need to first make a copy then increment then return the copy.
      In conversation Tuesday, 06-Feb-2018 12:35:27 EST from gs.smuglo.li permalink
      1. Mister M. T. Sack (thatbrickster@shitposter.club)'s status on Tuesday, 06-Feb-2018 12:36:37 EST Mister M. T. Sack Mister M. T. Sack
        in reply to
        @ayy It's said that on a 2GHz computer a millisecond would be saved for every one million iterations. Not much but the code in question is a hot path.
        In conversation Tuesday, 06-Feb-2018 12:36:37 EST from shitposter.club permalink
        1. ay (ayy@gs.smuglo.li)'s status on Tuesday, 06-Feb-2018 12:42:01 EST ay ay
          in reply to
          @thatbrickster I wonder... Modern processors are pretty complex beasts and I think they would emit equivalent uops for the two cases.
          Having an explicit loop may help the branch predictor for the first iterations, and the code size will be marginally smaller relieving cache pressure.
          In conversation Tuesday, 06-Feb-2018 12:42:01 EST from gs.smuglo.li permalink
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

Jonkman Microblog is a social network, courtesy of SOBAC Microcomputer Services. It runs on GNU social, version 1.2.0-beta5, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All Jonkman Microblog content and data are available under the Creative Commons Attribution 3.0 license.

Switch to desktop site layout.