- オブジェクト指向ソフトウェアでは適切なクラスを見つけるのが重要
- 絶対確実な方法はない
- 基本的な指針やアイディアを提供することは可能
- ただし、創造性が要求されるので、最終的には才能と経験と運が必要
- 方法論を説明することの第一の役割
- 啓蒙的な先駆者に注目
- すでに分かっている落とし穴を回避
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
;; http://www.sony.jp/ic-recorder/sound-compare/pcm/ | |
(defpackage resample | |
(:use :common-lisp) | |
(:export load-pcm | |
save-pcm | |
lpf | |
resample)) | |
(in-package :resample) | |
(defun load-pcm (path &key (signed t) (bits-per-sample 16) |
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
-module(bench_parallel). | |
-export([bench/4]). | |
%% @doc ベンチマーク関数 | |
%% | |
%% 一秒間に何回読み込み(検索)処理を行えるかを返す | |
-spec bench(module(), non_neg_integer(), non_neg_integer(), pos_integer()) -> ReadsPerSecond::non_neg_integer(). | |
bench(Module, EntryCount, ReadCount, ClientCount) -> | |
%% KVSプロセスの起動 |
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
%% 一応、gb_trees以外にも使えるようになっている | |
-module(bench). | |
-export([do_bench/5]). | |
%% @doc マップ(的なデータ構造)の構築時間と検索時間を測定する | |
do_bench(MapInit, StoreFun, FindFun, Input, Keys) -> | |
erlang:garbage_collect(), | |
{StoreTime, Map} = | |
timer:tc(fun () -> store_loop(MapInit, StoreFun, Input) end), |
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
%%% | |
%%% 基本的な使い方 | |
%%% | |
%% ハッシュリングの作成 | |
> Nodes = lists:map(fun hash_ring_node:make/1, [a,b,c,d,e]). | |
[{hash_ring_node,a,a,1}, | |
{hash_ring_node,b,b,1}, | |
{hash_ring_node,c,c,1}, | |
{hash_ring_node,d,d,1}, | |
{hash_ring_node,e,e,1}] |
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
-module(dist_bench). | |
%%% External API | |
-export([ | |
%% utility | |
make_node_specs/2, | |
setup_nodes/1, | |
do_bench/3, | |
%% scale out benchmarks |
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
%% erlang版 (動作未確認) | |
%% | |
%% 関数(節)本体を一行で書こうキャンペーン中 | |
-module(cup2). | |
-export([solve/1, solve_node/1]). | |
-export([make_node/0, make_node/1]). | |
-record(node, | |
{ |
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
// g++ -O3 -pthread -std=c++11 -o bench bench.cc | |
// | |
// Usage: bench type(0..6) thread_count loop_count | |
#include <iostream> | |
#include <cassert> | |
#include <cstdlib> | |
#include <thread> | |
#include <vector> | |
#include <functional> | |
#include "counter.hh" |