Skip to content

Instantly share code, notes, and snippets.

View superdump's full-sized avatar

Robert Swain superdump

View GitHub Profile
@superdump
superdump / bevy_render_v2.5.md
Last active September 29, 2023 15:12
Bevy Render v2.5

Design Goals

  • Avoid lookups in hot paths I.e. per-entity
    • 'Random' lookups cause cache misses whereas linear scans are much more cache coherent and so often perform much better

How things work on main at a5a457c3c82cc2e501bf6e85a2e2d07b5b7838a9

  • extract_meshes:
    • iterates an ECS query (good)
  • filters out non-visible entities based on the ViewVisibility component (good)
Running /Users/roberts/projects/rust/building-blocks/target/release/deps/greedy_quads-fa08d55d6e2b023d
Gnuplot not found, using plotters backend
greedy_quads_terrace/8 time: [10.510 us 10.582 us 10.658 us]
change: [-31.969% -31.222% -30.500%] (p = 0.00 < 0.05)
Performance has improved.
Found 5 outliers among 100 measurements (5.00%)
4 (4.00%) high mild
1 (1.00%) high severe
greedy_quads_terrace/16 time: [67.265 us 68.004 us 68.839 us]
change: [-39.006% -37.956% -36.982%] (p = 0.00 < 0.05)
// shapes.rs
use bevy::{
prelude::*,
render::{
mesh::{Mesh, VertexAttribute},
pipeline::PrimitiveTopology,
},
};
fn partition_points(vertices: &Vec<Vertex2>, e: &Edge, s_opt: Option<&Vec<(usize, f32)>>) -> (Vec<(usize, f32)>, Vec<(usize, f32)>) {
let mut s_right = Vec::<(usize, f32)>::new();
let mut s_left = Vec::<(usize, f32)>::new();
// i did this...
let closure = |i: &usize| {
if *i == e.origin || *i == e.destination {
return;
}
@superdump
superdump / README.md
Last active July 1, 2019 11:41
Compare hashes of files in two identical directory structures to check data integrity and copy from src to dst if hashes mismatch

My laptop was crashing repeatedly and I needed to back up the data. I had done an rsync from a couple of important directories on the laptop hard drive to an external drive:

rsync \
	--archive \
	--compress \
	--progress \
	--append-verify \
	--partial \
	--inplace \
diff --git a/Cargo.toml b/Cargo.toml
index c4ae846..587cc45 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,6 +15,7 @@ exclude = [
"benches/*",
"test.jpg"
]
+build = "build.rs"
template <class T>
class WeightedGraph {
public:
friend std::ostream& operator<<(std::ostream& out,
const WeightedGraph<T>& g);
...
};
template <class T>
// Copyright 2017 Vector Creations Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
createOffer: v=0
o=mozilla...THIS_IS_SDPARTA-52.0.2 1278190319635658274 0 IN IP4 0.0.0.0
s=-
t=0 0
a=fingerprint:sha-256 15:EB:38:50:FE:BC:52:22:E1:A9:4C:86:CB:27:A3:5E:EC:1D:4E:D7:26:AB:F0:FC:CB:61:69:92:41:B1:A7:B0
AFRAME.registerComponent('spherecube', {
schema: {
color: {type: 'color', default: '#FFF'},
radius: {type: 'number', default: '1'},
segments: {type: 'int', default: '8'},
},
init: function() {
const data = this.data;
const el = this.el;
this.geometry = new SphereCubeBufferGeometry(data.radius, data.segments);