I will add to this during the day each time I encounter annoyingly slow software
- Microsoft Visual Studio 2015 Shell Uninstall. ~1 hour on an I7 laptop with an SSD
x := | |
if foo { | |
do_stuff() // returns an int | |
} else if bar { | |
a := do_stuff() | |
print("stuff" | |
3*a | |
} else { | |
5 | |
} |
package apt | |
import ( | |
"github.com/jackmott/noise" | |
"math" | |
"math/rand" | |
"strconv" | |
) |
/* This code ported to Go from Stefan Gustavson's C implementation, his comments follow: | |
* https://github.com/stegu/perlin-noise/blob/master/src/simplexnoise1234.c | |
* SimplexNoise1234, Simplex noise with true analytic | |
* derivative in 1D to 4D. | |
* | |
* Author: Stefan Gustavson, 2003-2005 | |
* Contact: stefan.gustavson@liu.se | |
* | |
* | |
* This code was GPL licensed until February 2011. |
package main | |
// Experiment! draw some crazy stuff! | |
// Gist it next week and I'll show it off on stream | |
import ( | |
"fmt" | |
"github.com/veandco/go-sdl2/sdl" | |
) |
public static void Draw(GameTime gameTime) | |
{ | |
var effect = DDGame.contentManager.Load<Effect>("road"); | |
effect.Parameters["TerrainTexture"].SetValue(MainState.level.tex); | |
effect.Parameters["MaskTexture"].SetValue(MainState.maskTex); | |
DDGame.batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, effect); | |
DDGame.batch.Draw(MainState.roadTex, new Rectangle(0, 0, Settings.WINDOW_WIDTH, Settings.WINDOW_HEIGHT), Color.White); | |
DDGame.batch.End(); | |
} |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using Microsoft.Xna.Framework; | |
//Faster linq-style convenience functions https://github.com/jackmott/LinqFaster | |
using JM.LinqFaster; | |
namespace DrawAndDrive | |
{ |
I will add to this during the day each time I encounter annoyingly slow software
let mut finish_line_tex = texture_creator | |
.create_texture_streaming(PixelFormatEnum::RGB24, | |
FINISH_LINE_LENGTH as u32, | |
FINISH_LINE_WIDTH as u32) | |
.unwrap(); | |
finish_line_tex.set_blend_mode(BlendMode::Add); | |
finish_line_tex | |
.with_lock(None, | |
|buffer: &mut [u8], pitch: usize| for y in 0..FINISH_LINE_WIDTH { |
In general I have a problem with the whole set of short form, appeal to authority programmer advice things, of which there are many common examples:
One problem with these is that they are often stated as global truths, but are usually only true in specific cases. For each of these rules you must know when to break it. For instance the lead engine devs at ID Software say the exact opposite of the first quote - "Premature optimization is the root of all good". More important many of these things we just don't know to be true, we just think they are. And while I may
proc nameScore(name : string) : int = | |
for c in name: | |
result += int(c)-64 | |
var names = "names.txt".readFile().replace("\"").split(',') | |
names.sort(system.cmp) | |
var sum =0 | |
for i,name in names: | |
sum += nameScore(name)*(i+1) |