Files
hakorune/apps/ny-array-bench/main.nyash
Moe Charm de99b40bee Phase 12 TypeBox統合ABI設計完了: C ABI + Nyash ABI革命的統合
主な成果:
- TypeBox(型情報をBoxとして扱う)による統合ABI設計
- C ABI + Nyash ABIの完全統合仕様書作成
- 3大AI専門家(Gemini/Codex/ChatGPT5)による検証済み
- ChatGPT5の10個の安全性改善提案を反映
- README.mdのドキュメント更新(全起点から到達可能)

MapBox拡張:
- string型キーサポート(従来のi64に加えて)
- remove/clear/getOr/keysStr/valuesStr/toJson実装
- keys()/values()のランタイムシムサポート(TypeBox待ち)

その他の改善:
- Phase 11.9(文法統一化)ドキュメント追加
- Phase 16(FoldLang)ドキュメント追加
- 非同期タイムアウトテスト追加
- 各種ビルド警告(未使用import等)は次のリファクタリングで対応予定

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-02 09:26:09 +09:00

99 lines
2.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// ny-array-bench - ArrayBox性能ベンチマーク
// 目的: ArrayBox map/reduce、簡易可視化VM/JIT整合優先の最小版
// 出力: JSON形式のベンチマーク結果CI集計用
// 計測・集計は無効化VM/JITで同一挙動を優先
static box Main {
init { console }
main(args) {
me.console = new ConsoleBox()
// ベンチマーク設定ArrayBoxで明示作成
local sizes = new ArrayBox()
sizes.push(1000)
sizes.push(10000)
sizes.push(100000)
me.console.log("=== Nyash Array Benchmark ===")
me.console.log("Backend: " + me.getBackend())
me.console.log("")
// 各サイズでベンチマーク実行
local idx = 0
local n = sizes.length()
loop(idx < n) {
local size = sizes.get(idx)
me.console.log("Testing size: " + size)
me.benchArrayOps(size)
idx = idx + 1
}
// JSON結果出力固定の空オブジェクト
local result = "{}"
print(result)
return 0
}
getBackend() {
// 実行環境の判定(簡易版: VM固定
return "vm"
}
benchArrayOps(size) {
// VM/JIT 通過用の最小ダミー
}
// map実装×クロージャ → ○固定処理: 2倍
mapArrayDouble(array) {
local result = new ArrayBox()
local length = array.length()
local i = 0
loop(i < length) {
local value = array.get(i)
result.push(value * 2)
i = i + 1
}
return result
}
// reduce実装総和
reduceArraySum(array) {
local acc = 0
local length = array.length()
local i = 0
loop(i < length) {
acc = acc + array.get(i)
i = i + 1
}
return acc
}
// find実装等値
findInArrayEq(array, target) {
local length = array.length()
local i = 0
loop(i < length) {
local value = array.get(i)
if value == target {
return value
}
i = i + 1
}
return null
}
calculateRelativePerformance() {
// VMのみ記録簡易
StatsBox.recordRelative("vm", 1.0)
}
}