Created
December 16, 2019 05:25
-
-
Save nitrix/64e307cd448af069f80185df80c63182 to your computer and use it in GitHub Desktop.
Go image pkg overhead vs array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"image" | |
"image/color" | |
"time" | |
) | |
func main() { | |
// pixels := [1920 * 1080]uint8{} | |
img := image.NewRGBA(image.Rectangle{Max: image.Point{ | |
X: 1920, | |
Y: 1080, | |
}}) | |
before := time.Now() | |
for z := 0; z < 60; z++ { | |
for x := 0; x < 1920; x++ { | |
for y := 0; y < 1080; y++ { | |
// pixels[y * 1920 + x] = 1 | |
img.Set(x, y, color.RGBA{ | |
R: 255, | |
G: 255, | |
B: 255, | |
A: 255, | |
}) | |
} | |
} | |
} | |
fmt.Println("Time: ", time.Since(before)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment