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 |
- GitHub Staff
- https://hparker.xyz/
- @theHessParker
- @[email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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%
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)
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':
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Play this game by pasting the script in http://www.puzzlescript.net/editor.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Play this game by pasting the script in http://www.puzzlescript.net/editor.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
title Totally Fine Library | |
author Adam Hess | |
homepage www.hparker.xyz | |
======== | |
OBJECTS | |
======== | |
Player |
NewerOlder