<前の日記(2006年07月17日) 次の日記(2006年07月23日)> 最新 編集

高木浩光@自宅の日記

目次 はじめに 連絡先:blog@takagi-hiromitsu.jp
訪問者数 本日: 2850   昨日: 2371

2006年07月18日

ギャー! 訂正

ギャー! やってしまった orz。16日の日記掲載のプログラムはバグっていた。java.util の新しい方のコレクションクラスは synchronized じゃないのを思い出し、どのくらい影響があったか task.log からノードの重複を除いて計数したところ、相当な数のノードがダブっていたもよう。

以下の通り訂正。実行時間やグラフ形状がどう変化するかはまだ不明。

16日の日記の実験結果ノード数
誤: 389,288 → 正: 200,036

17日の日記の実験結果1つ目のノード数
誤: 388,994 → 正: 201,619

17日の日記の実験結果2つ目のノード数
誤: 343,001 → 正: 199,316

17日の日記の実験結果3つ目のノード数
誤: 581,856 → 正: 224,453

この結果はネットエージェント7月3日発表のノード数よりかなり少ない。うむむ。

16日の日記のプログラムの訂正:
誤:

Set<Node> foundNodes = new HashSet<Node>();
正:
Set<Node> foundNodes = java.util.Collections.synchronizedSet(new HashSet<Node>());

ギャー、ここも杜撰だった。(モニタリング用のコードとはいえ。)

int connectionTriedCount = 0;
int handshakeSucceededCount = 0;
int extractionSucceededCount = 0;
connectionTriedCount++;
handshakeSucceededCount++;
extractionSucceededCount++;

java.util.concurrent.atomic.AtomicInteger を使ってみよう。

import java.util.concurrent.atomic.AtomicInteger;
...
AtomicInteger connectionTriedCount = new AtomicInteger(0);
AtomicInteger handshakeSucceededCount = new AtomicInteger(0);
AtomicInteger extractionSucceededCount = new AtomicInteger(0);
...
connectionTriedCount.getAndIncrement();
handshakeSucceededCount.getAndIncrement();
extractionSucceededCount.getAndIncrement();

<前の日記(2006年07月17日) 次の日記(2006年07月23日)> 最新 編集

最近のタイトル

2000|01|
2003|05|06|07|08|09|10|11|12|
2004|01|02|03|04|05|06|07|08|09|10|11|12|
2005|01|02|03|04|05|06|07|08|09|10|11|12|
2006|01|02|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|05|06|07|08|09|10|11|12|
2012|02|03|04|05|06|07|08|09|
2013|01|02|03|04|05|06|07|
2014|01|04|07|09|11|12|
2015|01|03|06|07|10|11|12|
2016|01|02|03|04|06|07|08|10|11|12|
2017|01|02|03|04|05|06|07|10|12|
2018|03|05|06|10|12|
2019|02|03|05|06|07|08|10|
2020|08|09|
2021|07|08|10|12|
2022|01|04|06|12|
2023|03|
2024|03|04|07|11|12|
2025|01|02|03|04|05|06|10|11|12|
<前の日記(2006年07月17日) 次の日記(2006年07月23日)> 最新 編集