Skip to content

Instantly share code, notes, and snippets.

@bssrdf
bssrdf / blender_slow.md
Last active August 2, 2023 15:26
A curious case of O(N^2) behavior which should be O(N)

Motivation

Recently I got interested in Blender 3D, partly inspired by infinigen project.

One day I encountered Tellusim. Impressed by the quality of its rendering, I was browsing its blogs and see this. Wow, Tellusim really blowed others out of the water;others including Unreal, Unity, Omniverse and Blender. Wait, Blender is really that slow importing a USD scene?

Since Blender is open-source, why not try to figure out what's going on? Here we go.

First, let's profile it

@bssrdf
bssrdf / ANSI.md
Created December 11, 2021 23:04 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27

Auxiliary Array

For some array problems on leetcode, often we need to use some extra data structures to efficiently solve them. A useful one is so called auxiliary array. This is a typical space time tradeoff strategy. Here we use some examples to illustrate the different kinds of auxiliary arrays.

  1. L/R Min/Max Array

    This array is in the same size as the input array. They contain values which are min or max of the input array at the index i from left or right. Here is a problem to which this kind of array is very useful.

    334 Increasing Triplet Subsequence

Some combimnatorial problems require a specific technique called backtracking. The common problems in this category are permuation, combination and subsets. Backtracking is a general algorithm for finding all (or some) solutions to some computational problems, that incrementally builds candidates to the solutions. As soon as it determines that a candidate cannot possibly lead to a valid complete solution, it abandons this partial candidate and “backtracks’’ (return to the upper level) and reset to the upper level’s state so that the search process can continue to explore the next branch. Backtracking always work in recursive functions. Here I want to emphasize one aspect of applying backtracking to these problems: the ordering.

The ordering in the current context is referring to the order in which the the items are listed to form the final product. For some problems, this order is not important; while for others, the order matters. In other words, to the former, all items forming only one list; in the latt

@bssrdf
bssrdf / BDS.cpp
Created September 2, 2018 21:32 — forked from sameer-j/BDS.cpp
Bidirectional Search Implementation in C++
//Applies BFS from both source and destination side and checks after each iteration if the visited
//list from each side are intersecting at any point. If yes, then thats the meeting point and gives the
//path from source to that point and from that point to destination
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <stdlib.h>
using namespace std;
@bssrdf
bssrdf / col.md
Created March 3, 2018 20:03 — forked from vurtun/col.md

screen0 screen1

@bssrdf
bssrdf / gist:8e819ee69b54058511b7
Created October 1, 2015 19:59 — forked from debasishg/gist:8172796
A collection of links for streaming algorithms and data structures
  1. General Background and Overview