以下の6つの機能を分離し、簡単に切り替えられるようにしたい。
- OSからのメモリアロケータ
- OSからメモリアロケートする部分のAPI
- Rubyのヒープ管理
- ヒープの設定を保持
| #!/usr/bin/env ruby | |
| # | |
| # pid2line.rb | |
| # | |
| # Show source files and line numers of given process's threads | |
| # | |
| # This script works only on Linux. | |
| # https://gist.github.com/nurse/0619b6af90df140508c2 | |
| # |
| *** client/mysql.cc.orig 2015-09-18 23:24:43.000000000 +0900 | |
| --- client/mysql.cc 2015-11-26 19:42:19.469000382 +0900 | |
| *************** | |
| *** 1128,1130 **** | |
| static void mysql_end_timer(ulong start_time,char *buff); | |
| ! static void nice_time(double sec,char *buff,bool part_second); | |
| extern "C" sig_handler mysql_end(int sig); | |
| --- 1128,1130 ---- | |
| static void mysql_end_timer(ulong start_time,char *buff); | |
| ! static void nice_time(ulong sec,char *buff,bool part_second); |
| # 私が考える安全なプログラムを書くために必要なこと | |
| 今も昔も「入力によって挙動が大幅に変わるAPI」が世の中には多数存在していて、プログラマが本来意図した挙動と異なる動作を引き起こしている。 | |
| - ファイルを開こうとしたらコマンドを実行できてしまったり | |
| - CSSセレクタを書いてるつもりがHTMLタグを生成してしまったり | |
| - SELECT文を発行するつもりがDELETE文を発行できてしまったり | |
| こういったときに | |
| - 入力値検証をしないと危険になる |
| window.addEventListener("message", function(e){ console.log(e) }); |
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| use lib 'extlib/lib/perl5'; | |
| use DBIx::Sunny; | |
| use Parallel::ForkManager; | |
| use File::Temp qw/tempfile/; | |
| use Time::HiRes qw/gettimeofday tv_interval/; |
| var JSX = {}; | |
| (function () { | |
| /** | |
| * copies the implementations from source interface to target | |
| */ | |
| function $__jsx_merge_interface(target, source) { | |
| for (var k in source.prototype) | |
| if (source.prototype.hasOwnProperty(k)) | |
| target.prototype[k] = source.prototype[k]; |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| #!perl | |
| use strict; | |
| use warnings; | |
| use Net::Google::Calendar; | |
| use Config::Pit; | |
| use DateTime; | |
| use Email::MIME; | |
| use Data::Dumper; | |
| use HTTP::Date (); | |
| use FindBin; |