Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Живе Беларусь!

Dzmitry Malyshau kvark

💭
Живе Беларусь!
View GitHub Profile
View art-of-debugging.md

Art of Debugging

Obligatory disclaimer, this is all opinion and cannot possibly generalize to all problems, workflows, environments, etc. This is meant primarily as a launching point for an open-ended discussion on best practices in debugging code. This is a sketch of what may be a brief book that covers each point below with anecdotes, examples, and techniques.

Hypothesis 0

The ultimate goal of a debugging session is to rule out possibilities until only one remains. All applications of best practices, techniques, and tools should be pointed at this purpose (contextualize all points below against this statement). Debugging is first and foremost a critical thinking problem, and presence of mind is your most critical asset. Establish a mental model but do not be afraid to invalidate it as the investigation unfolds.

sherlock

Hypothesis 1

@kvark
kvark / rust-graphics.md
Created Sep 9, 2017
Rust Graphics Libraries Navigator
View rust-graphics.md

What sort of graphics do you need?

  • 2D only. All you need is...
  • 3D for sure. Do you like making your hands dirty?
View game_world.rs
use cgmath::{Vector3};
use slog::{Logger};
use cobalt_rendering::{Target, Texture, TextureFormat};
use cobalt_rendering_world3d::{World, Model, Entity, Light, EntityId, LightId, Material};
use input::{InputState, FrameInput};
use player::{Player};
pub struct GameWorld {
pub player: Player,
@kvark
kvark / forest-exe.tgz
Last active Aug 29, 2015
gfx_scene slides
View forest-exe.tgz
This file has been truncated, but you can view the full file.
View gist:130019f80fa4dd263532
Gfx and glium are Rust libraries that aim to provide a "rusty" abstraction over graphics programming APIs.
Both may look similar, and one of the questions that gets asked frequently on IRC is "what are the differences between gfx and glium?". Here is a comparison table:
| Gfx | Glium
-------------------------------------|-------------------------------------------------------------------------------------------------------------------|--------------------------------
URL | <https://github.com/gfx-rs/gfx-rs> | <https://github.com/tomaka/glium>
History | Papers since Oct 2013. Really started in June 2014. | Private/confidential from Feb 201
@kvark
kvark / links.md
Last active Aug 29, 2015
Useful links to read
View links.md
@kvark
kvark / clustered.md
Last active Nov 23, 2019
Clustered pipeline description
View clustered.md
@kvark
kvark / RustVsC++.md
Last active Aug 10, 2018
Rust >> C++ #research
View RustVsC++.md

Reasons why Rust can be faster than C++:

  • aliasing information available to compiler (automatic __restrict)
  • one less jump on virtual functions due to traits (Runtime polymorphism)
  • undefined struct layout
  • reference counting (Rc<T>) is lock-free because of being task-local
  • allocator model: rust provides hints and could inline calls to jemalloc (issue, RFC)

It's worth noting that since Rust restricts pointers more than C does, the ordering restrictions on pointers could be relaxed. This hasn't been implemented in LLVM yet since most of the optimization work is based on leveraging the rules of C and C-family languages. Even if they did implement relaxations on the reordering rules, however, storing data in registers will still be easier to optimize.

You can’t perform that action at this time.