Skip to content

Instantly share code, notes, and snippets.

Noah Gibbs noahgibbs

Block or report user

Report or block noahgibbs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View thread_vs_fork_test.patch
C02RP0G1G8WM:pipe noah.gibbs$ diff -c thread_test.rb fork_test.rb
*** thread_test.rb 2019-08-30 19:04:45.000000000 -0700
--- fork_test.rb 2019-08-30 16:15:08.000000000 -0700
***************
*** 8,14 ****
RESPONSE_TEXT = "OK".freeze
if ARGV.size != 2
! STDERR.puts "Usage: ./thread_test <num_workers> <num_requests>"
exit 1
@noahgibbs
noahgibbs / multiply.rb
Created Aug 3, 2019
Simple "multiply two numbers" benchmark w/ MJIT output
View multiply.rb
def multiply(a, b)
a * b
end
1_000_000.times do
multiply(7.0, 10.0)
end
@noahgibbs
noahgibbs / multiply.rb.c
Created Jul 19, 2019
An MJIT file generated from multiply.rb by prerelease Ruby 2.7
View multiply.rb.c
/* block in <main>@./multiply.rb:5 */
#undef OPT_CHECKED_RUN
#define OPT_CHECKED_RUN 0
ALWAYS_INLINE(static VALUE _mjit_inlined_6(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, const VALUE orig_self, const rb_iseq_t *original_iseq));
static inline VALUE
_mjit_inlined_6(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, const VALUE orig_self, const rb_iseq_t *original_iseq)
{
const VALUE *orig_pc = reg_cfp->pc;
@noahgibbs
noahgibbs / r00lz.rb
Created Apr 28, 2019
R00lz.to_underscore, for those who hate typing out regexps visually.
View r00lz.rb
# r00lz/lib/r00lz.rb
module R00lz
def self.to_underscore(s)
s.gsub(
/([A-Z]+)([A-Z][a-z])/,
'\1_\2').gsub(
/([a-z\d])([A-Z])/,
'\1_\2').downcase
end
end
@noahgibbs
noahgibbs / discourse_jit_error.txt
Created Dec 4, 2018
Internal error during benchmarking 2.6.0pre3
View discourse_jit_error.txt
+ RUBYOPT=--jit
+ ./start.rb -i 10000 -w 100 -s 0 --no-warm-start -o data/
WARN: Unresolved or ambigious specs during Gem::Specification.reset:
unf_ext (>= 0)
Available/installed versions of this gem:
- 0.0.7.2
- 0.0.7.1
WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'
Please report a bug if this causes problems.
/home/ubuntu/.rvm/gems/ruby-2.6.0-preview3/gems/onebox-1.8.6/lib/onebox/preview.rb:5: warning: constant Net::HTTPServerException is deprecated
@noahgibbs
noahgibbs / action_cable_weird_shit.txt
Created Aug 3, 2018
action_cable_weird_shit.txt
View action_cable_weird_shit.txt
You can .send() from JavaScript and .receive() from Ruby. But if you use "action" as a field in the hash, it treats it as a named action and receive() doesn't work.
Reloading. In general, reloading is a weird process. Reloading the browser can sometimes but not always reload the Ruby classes. Channel objects don't seem to reliably reload on the Ruby side, just in general.
In the documentation, streams vs channels. How they're named, how they're used.
Multiple ActionCable servers. Which is why "disconnect" operates by sending a pub/sub message to all servers to disconnect everybody "identified_by" what you sent.
Identified_by. Never really explained. Seems to only be usable for .disconnect?
@noahgibbs
noahgibbs / gist:f006364c3b335046314d9cdcbaa5c4d6
Created Jul 16, 2018
Robert Pozen writing advice, very abbreviated notes
View gist:f006364c3b335046314d9cdcbaa5c4d6
Make an Outline:
* Brainstorm
* Categorize (arrange into categories and subcategories)
* Outline
Introduction:
* Provide the Reader with Context
* State the main theme
* Explain the organization (what you'll get, how you'll get it)
@noahgibbs
noahgibbs / index.html
Created May 23, 2017
Rails Ruby Bench Throughput by Ruby Version
View index.html
<!-- Embeddable, not full-page -->
<link type="text/css" rel="stylesheet" href="http://code.shutterstock.com/rickshaw/src/css/graph.css">
<link type="text/css" rel="stylesheet" href="http://code.shutterstock.com/rickshaw/src/css/detail.css">
<link type="text/css" rel="stylesheet" href="http://code.shutterstock.com/rickshaw/src/css/legend.css">
<!-- <link type="text/css" rel="stylesheet" href="css/extensions.css"> -->
<!-- Note: Rickshaw uses D3.js version 3, not 4 -->
<script src="https://d3js.org/d3.v3.min.js"></script>
<script src="http://code.shutterstock.com/rickshaw/rickshaw.min.js"></script>
@noahgibbs
noahgibbs / benchmark_data.txt
Created Apr 19, 2017
Raw run data from Rails Ruby Bench
View benchmark_data.txt
Ruby Version: 2.0.0, data points: 15000, full runs: 10
0%ile: 0.0068682490000000485
1%ile: 0.011501136530000072
5%ile: 0.022750594349999993
10%ile: 0.035768121299999844
50%ile: 0.1570052820000003
90%ile: 0.3480380704999999
95%ile: 0.41832731610000007
99%ile: 0.6091764846900004
100%ile: 1.117286536
View gist:3b020be537471e05b66b0aed6c5bef40
C02RP0G1G8WM:rails_ruby_bench noah.gibbs$ rvm install ruby-head
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/noah.gibbs/.rvm/rubies/ruby-head, this may take a while depending on your cpu(s)...
HEAD is now at ff3496b011 vm_insnhelper.c: block argument at tailcall
remote: Counting objects: 751, done.
remote: Compressing objects: 100% (84/84), done.
remote: Total 751 (delta 364), reused 330 (delta 330), pack-reused 336
Receiving objects: 100% (751/751), 645.53 KiB | 0 bytes/s, done.
You can’t perform that action at this time.