Skip to content

Instantly share code, notes, and snippets.

View HParker's full-sized avatar
💭
🥦

Adam Hess HParker

💭
🥦
View GitHub Profile
==18580== 1,104 bytes in 1 blocks are possibly lost in loss record 2 of 3
==18580== at 0x4845828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==18580== by 0x159B49: UnknownInlinedFun (alloc.rs:14)
==18580== by 0x159B49: UnknownInlinedFun (stats.rs:38)
==18580== by 0x159B49: UnknownInlinedFun (stats.rs:29)
==18580== by 0x159B49: UnknownInlinedFun (alloc.rs:98)
==18580== by 0x159B49: UnknownInlinedFun (alloc.rs:181)
==18580== by 0x159B49: UnknownInlinedFun (alloc.rs:241)
==18580== by 0x159B49: UnknownInlinedFun (alloc.rs:15)
==18580== by 0x159B49: new_uninitialized<alloc::alloc::Global> (mod.rs:1754)
@HParker
HParker / nodes.md
Last active April 26, 2023 19:26
Onigmo Tokens
Node Type Usage
NT_STR String Node
NT_CCLASS Character class i.e. [abc]
NT_CTYPE character type as in \w
NT_CANY anychar node such as .
NT_BREF Backreference node
NT_QTFR Quantifier node
NT_ENCLOSE Enclosing ndoe such as (abc)
NT_ANCHOR Location anchors such as \A
# coding: utf-8
# Steps to convert a regular expression into a NFA
#
# 1. create NFAs for each trivial part of the regular expression.
# 2. join them together replacing the transition part with one of the trivial parts created above.
# 3. mark the final state a success
require 'set'
class State
attr_reader :id

instruction: "getlocal_WC_0" (10811170.0)

arg: "value@0" count: 769392 7.12%

arg: "options@0" count: 756202 6.99%

arg: "name@0" count: 742120 6.86%

arg: "value@1" count: 657734 6.08%
@HParker
HParker / rails-bench-instruction-sequences.md
Created October 17, 2022 19:37
Common instruction sequences from rails_bench

results (11455261) instructions captured

==== top ====

getlocal_WC_0 = 1903656
opt_send_without_block = 1638356
leave = 1057370
putself = 729499
branchunless = 626085

opt_send_without_block: total = 26763344

putself = 5201835/26763344 (0.19436416465745088)

getlocal_WC_0 = 3166018/26763344 (0.11829680177484547)

getinstancevariable = 2921009/26763344 (0.10914215353656853)

opt_send_without_block = 2193804/26763344 (0.08197047424268059)
@HParker
HParker / CommonSequences.md
Created September 23, 2022 00:54
Common YARV Instruction Sequences

Common instruction sequences

What are some common instruction sequences in Ruby?

Results

results (172130552) instructions captured

@HParker
HParker / .Question.md
Last active September 22, 2021 02:23
BrainF*** -> qbe -> assembly

Why is this assembly so slow?

This is a super nieve implementation of brainf*** which gererates QBE's SSA which then generates assembly code. It generates a HUGE number of instructions, but I still don't understand why this is SIGNIFICANTLY slower then a similarly nieve interpreter. my thought was that even with a really silly implementation like this, it should still be "as fast" as the nieve interpreted version. What am I doing wrong? How is it so slow?

perf stat ./a.out

Performance counter stats for './a.out':

@HParker
HParker / readme.txt
Created July 31, 2021 21:22
Totally Fine Library (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@HParker
HParker / readme.txt
Created July 1, 2021 03:54
Totally Fine Library (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html