Coder Social home page Coder Social logo

brainfucc's Introduction

the Princess Japanoise

  • Special interest: text editors
  • Pronouns: she/her
  • Here for: hacking on text editors, not porting things to Rust, pretending to be a unix trendy hipster by checking in my dotfiles
  • Tools of the trade:
    • GNU Emacs, the world's best text editor
    • Gomacs or emsys, not the world's best text editor but good enough to replace the editor of the beast
    • zsh, the better shell (yes it's better than fish, no I will not elaborate)
    • My personal configurations, a wretched hive of scum and villainy
    • btw linux
    • msys2 (when I'm forced to use windoze)
    • iterm2 and a stiff drink (when I'm forced to use Mac OS OSX MacOS)
  • Work status: employed as a software developer
  • Contact me if:
    • You are interested in speaking to me about an employment opportunity
    • You are interested in helping me maintain one of my repositories (especially Gomacs)
    • (If you are LGBTQ+) You want to contribute and need a mentor with industry experience
    • You have a question about Golang, Shell, or text editors that you think I can answer (don't ask to ask, just ask)
    • You have discovered a serious security vulnerability in my setup or repositories (rewards negotiable)
    • You want to give me constructive feedback on one of my repositories
    • You think I seem cool and want to be friends
  • Do not contact me if:
    • You want to bikeshed one of my repositiories
    • You want me to debate you
    • You want to scold me
    • You want to complain unproductively (if you have an issue with one of my repositories, file a ticket or make a PR)
    • You are in crisis - I'm sorry, but I am not a crisis counselor and most likely cannot help you, please call a hotline or speak to someone you trust
    • Your message is about cryptocurrency, NFTs, or blockchains

I am elsewhere on the web:

My name comes from the Japanese Harsh Noise "Music" Scene; I am not Japanese. If that sounds interesting to you, check out (headphone warning):

Language knowledge

Professional experience:

  • Go
  • Python
  • Perl
  • Java
  • Groovy
  • Shell (bash, sh, etc)

Languages I can do anything in:

  • Go
  • Shell

Languages I know very well:

  • Java
  • C
  • Perl
  • Python

Languages I know but don't actively use ATM:

  • Forth
  • Scheme
  • Erlang
  • C++
  • Javascript
  • Groovy
  • asm, flavors:
    • gbz80
    • x86

Languages I have played with:

  • Crystal
  • J
  • Haskell
  • OCaml
  • Standard ML
  • BASIC
  • VB
  • 6502 asm

brainfucc's People

Contributors

japanoise avatar

Stargazers

 avatar

Watchers

 avatar

brainfucc's Issues

mmap (or buffer) files

I poked around with the code and replaced the stdio file calls with mmap.

Tested on this file: https://github.com/rdebath/Brainfuck/blob/master/testing/Golden.b

score@kirisame ~/src/brainfucc % time stdbuf -o0 ./brainfucc-orig ../brainfuck-interpreter/toys/Golden.b
1.618033988749894848204586834365638117stdbuf -o0 ./brainfucc-orig ../brainfuck-interpreter/toys/Golden.b  13.45s user 4.84s system 99% cpu 18.287 total
score@kirisame ~/src/brainfucc % time stdbuf -o0 ./brainfucc ../brainfuck-interpreter/toys/Golden.b 
1.618033988749894848204586834365638117stdbuf -o0 ./brainfucc ../brainfuck-interpreter/toys/Golden.b  0.72s user 0.00s system 99% cpu 0.728 total

That's a 25x speedup :^)

mmap probably doesn't work on Windows systems though, so you'll probably just want to buffer the whole file into memory. You'll likely get an identical speedup.

BTW, notice how long the original interpreter spends in "system" - that's 4.84 seconds spent on file seeking and re-reading alone.

I leave the rest to you!

no fclose

Need to fclose files once we're done with them

Comma should take one character only

Currently it reads then discards until the end of the line (which seems like something for debugging purposes). Terminals usually allow you to flush your pending input with Ctrl+D (and hitting that when there is nothing in the buffer will send EOF).

According to the brainfuck spec and most implementations of it, the comma operator should read in only one character.

To test, you should be able to copy a file from stdin to stdout (ignoring those with embedded 00s and FFs) with one of these programs:

  • if EOF returns -1 (as getchar does): +[>[<-.>-]+<,+]
  • if EOF returns 0 or unchanged: +[>[<.>-]+<[-],]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.