Skip to content
  1. Jun 15, 2017
  2. Jun 11, 2017
  3. Jun 10, 2017
    • faiface's avatar
      Merge branch 'dev' · 12df2032
      faiface authored
      12df2032
    • faiface's avatar
      one more tiny doc change · d4cd1c33
      faiface authored
      d4cd1c33
    • faiface's avatar
      minor doc changes · 51cd0314
      faiface authored
      51cd0314
    • Michal Štrba's avatar
      Merge pull request #38 from seebs/master · 6a921131
      Michal Štrba authored
      more performance tweaks
      6a921131
    • Seebs's avatar
      Push: Don't convert pixel.RGBA to pixel.RGBA · ee5d49db
      Seebs authored
      Because that's expensive, even in the case where the conversion
      is trivial. Use type assertion first. Reduces runtime cost of
      imdraw.Push from ~15.3% to 8.4%, so not-quite-50% of runtime
      cost of pushing points.
      
      If you were setting imd.Color to Color objects that aren't RGBA
      every single point, not much help. But if you set it and then
      draw a bunch of points, this will be a big win.
      ee5d49db
    • Seebs's avatar
      Improve normal calculations · daedc45e
      Seebs authored
      Soooo. It turns out that the bunch of smallish (~4-5% of runtime)
      loads associated with Len(), Unit(), Rotated(), and so on... Were
      actually more like 15% or more of computational effort. I first
      figured this out by creating:
      
      	func (u Vec) Normal(v Vec) Vec
      
      which gives you a vector normal to u->v. That consumed a lot
      of CPU time, and was followed by .Unit().Scaled(imd.thickness / 2),
      which consumed a bit more CPU time.
      
      After some poking, and in the interests of avoiding UI cruft,
      the final selection is
      	func (u Vec) Normal() Vec
      
      This returns the vector rotated 90 degrees, which turns out to
      be the most common problem.
      daedc45e
    • Seebs's avatar
      Slightly clean up normal calculations · 678da34f
      Seebs authored
      We never actually need the "normal" value; it's an extra calculation
      we didn't need, because ijNormal is the same value early on. It's
      totally possible that we could further simplify this; there's a lot
      of time going into the normal computations.
      678da34f
    • Seebs's avatar
      don't call Len() when it can't change · f68301dc
      Seebs authored
      updateData()'s loops checking gt.Len() turns out to have been costing
      significant computation, not least because each call then in turn
      called gt.vs.Stride().
      f68301dc
    • faiface's avatar
      switch back to OpenGL 3.3 (OS X issues) · cfdc8beb
      faiface authored
      cfdc8beb
  4. Jun 09, 2017
    • faiface's avatar
      optimize GLTriangles SetLen and Update · 1fd110ce
      faiface authored
      1fd110ce
    • faiface's avatar
      Merge branch 'master' into gl2.1 · 3665eaf7
      faiface authored
      3665eaf7
    • faiface's avatar
      minor, mostly stylistic, changes · c0766504
      faiface authored
      c0766504
    • Michal Štrba's avatar
      Merge pull request #36 from seebs/master · 5f2ced88
      Michal Štrba authored
      revised performance tuning pull request
      5f2ced88
    • Seebs's avatar
      Don't duplicate computations in gltriangles.go · ce8687b8
      Seebs authored
      The computation including a call to Stride() can't be optimized away
      safely because the compiler can't tell that Stride() is effectively
      constant, but we know it won't change so we can make a slice pointing
      at that part of the array.
      
      CPU time for updateData goes from 26.35% to 18.65% in my test case.
      ce8687b8
    • Seebs's avatar
      Reduce copying in fillPolygon · c6e7a834
      Seebs authored
      A slice of points means copying every point into the slice, then
      copying every point's data from the slice to TrianglesData. An
      array of indicies lets the compiler make better choices.
      c6e7a834
    • Seebs's avatar
      smaller imdraw optimizations · b6533006
      Seebs authored
      For polyline, don't compute each normal twice; when we're going through a line,
      the "next" normal for segment N is always the "previous" normal for segment
      N+1, and we can compute fewer of them.
      b6533006
    • Seebs's avatar
      use point pool · 9d1fc5bd
      Seebs authored
      For internal operations (anything using getAndClearPoints), there's a
      pretty good chance that the operation will repeatedly invoke something
      like fillPolygon(), meaning that it needs to push "a few" points
      and then invoke something that uses those points.
      
      So, we add a slice for containing spare slices of points, and on the
      way out of each such function, shove the current imd.points (as used
      inside that function) onto a stack, and set imd.points to [0:0] of
      the thing it was called with.
      
      Performance goes from 11-13fps to 17-18fps on my test case.
      9d1fc5bd
    • Seebs's avatar
      Simplify Matrix math, use 6-value affine matrixes. · c321515d
      Seebs authored
      It turns out that affine matrices are much simpler than the 3x3 matrices
      they imply, and we can use this to dramatically streamline some code.
      For a test program, this was about a 50% gain in frame rate just from
      the cost of the applyMatrixAndMask calls in imdraw, which were calling
      matrix.Project() many times. Simplifying matrix.Project, alone, got a
      nearly 50% frame rate boost!
      
      Also modify pixelgl's SetMatrix to copy the six values of a 3x2
      Affine into the corresponding locations of a 3x3 matrix.
      c321515d
  5. Jun 08, 2017
    • Seebs's avatar
      The initializer is surprisingly expensive. · 1586e600
      Seebs authored
      Removing the call to Alpha(1) and replacing it with an inline definition
      produces measurable improvements. Replacing each instance of ZV with
      Vec{} further improves things. We keep an inline RGBA because there
      are circumstances (mostly when using pictures) where we don't want to
      have to set colors to get default behavior.
      
      For a fairly triangle-heavy thing, this reduces time spent in SetLen
      from something over 10% of execution time to around 2.5% of execution
      time.
      1586e600
  6. May 30, 2017
  7. May 28, 2017
  8. May 27, 2017
  9. May 25, 2017
  10. May 24, 2017
  11. May 21, 2017