ほかに処理速度の比較が出来る指標は無いの?
- User
ほかに処理速度の比較が出来る指標は無いの?
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
ほかに処理速度の比較が出来る指標は無いの?
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
はい、FPSとメモリ消費量以外にも、カスタムアトリビュートのパフォーマンス影響を測定できる指標がいくつかあります。以下に主要なものを挙げます:
-- ① 時間測定ヘルパー関数
fn measureTime func =
(
local startTime = timestamp()
func()
local endTime = timestamp()
return (endTime - startTime) / 1000.0 -- 秒単位で返す
)
-- ② オブジェクト作成時間測定
fn measureCreationTime count attr =
(
local createFunc = function()
(
for i = 1 to count do
(
local h = point name:("H" + i as string) pos:[random -100 100, random -100 100, 0]
if (attr != undefined) then
(
local attrHold = EmptyModifier name:"Attribute_Holder"
addModifier h attrHold
custAttributes.add h.modifiers[#Attribute_Holder] attr
)
)
)
return measureTime createFunc
)
-- ③ 選択応答時間測定
fn measureSelectionTime objArray =
(
local selectFunc = function()
(
for obj in objArray do
(
select obj
deselect obj
)
)
return measureTime selectFunc
)
-- ④ プロパティアクセス時間測定
fn measurePropertyAccess objArray propName =
(
local accessFunc = function()
(
for obj in objArray do
(
if obj.modifiers[#Attribute_Holder] != undefined then
(
try
(
-- プロパティ読み込み
local val = custAttributes.getProperty obj.modifiers[#Attribute_Holder] propName
-- プロパティ書き込み
custAttributes.setProperty obj.modifiers[#Attribute_Holder] propName (val + 1)
)
catch()
)
)
)
return measureTime accessFunc
)
-- ⑤ ファイル保存時間測定
fn measureSaveTime =
(
local tempFile = (getDir #temp) + "\\benchmark_temp.max"
local saveFunc = function()
(
saveMaxFile tempFile quiet:true
)
local saveTime = measureTime saveFunc
try (deleteFile tempFile) catch()
return saveTime
)
-- ⑥ ビューポート操作時間測定
fn measureViewportOps =
(
local viewportFunc = function()
(
-- ビューポート操作シミュレーション
viewport.setFOV 45
viewport.setFOV 60
viewport.setFOV 45
-- ビューポートタイプ変更
viewport.setType #view_top
viewport.setType #view_front
viewport.setType #view_persp_user
)
return measureTime viewportFunc
)
-- ⑦ ガベージコレクション時間測定
fn measureGCTime =
(
local gcFunc = function()
(
gc()
)
return measureTime gcFunc
)
-- ⑧ 包括ベンチマーク関数
fn runComprehensiveBenchmark =
(
clearListener()
format "=== 包括的ベンチマーク開始 ===\n\n"
local testObjCount = 500
local results = #() -- 結果保存用配列
-- カスタムアトリビュート定義
local lightCA = defineCA #light
local heavyCA = defineCA #heavy
-- 各シナリオのテスト
local scenarios = #(
#(#base, undefined, "Base (CA無し)"),
#(#light, lightCA, "Light UI"),
#(#heavy, heavyCA, "Heavy UI")
)
for scenario in scenarios do
(
local scenarioName = scenario[1]
local attr = scenario[2]
local displayName = scenario[3]
format "🔄 % テスト中...\n" displayName
-- シーンリセット
resetMaxFile #noPrompt
disableSceneRedraw()
-- 1. オブジェクト作成時間
local creationTime = measureCreationTime testObjCount attr
-- 作成されたオブジェクトを取得
local objArray = for obj in objects where iskindof obj Point collect obj
enableSceneRedraw()
completeRedraw()
-- 2. メモリ使用量
gc light:true
local memUsed = (heapSize - heapFree) as float
-- 3. 選択応答時間
local selectionTime = measureSelectionTime objArray
-- 4. プロパティアクセス時間(CA有りの場合のみ)
local propAccessTime = 0
if attr != undefined then
(
propAccessTime = measurePropertyAccess objArray #sp
)
-- 5. ファイル保存時間
local saveTime = measureSaveTime()
-- 6. ビューポート操作時間
local viewportTime = measureViewportOps()
-- 7. ガベージコレクション時間
local gcTime = measureGCTime()
-- 8. FPS測定
local fps = measureFPS 30
-- 結果を配列に保存
append results #(
scenarioName,
displayName,
creationTime,
bytesToMB memUsed,
selectionTime,
propAccessTime,
saveTime,
viewportTime,
gcTime,
fps
)
format " 完了\n"
)
-- 結果表示
format "\n=== 包括ベンチマーク結果 ===\n\n"
format "%-15s %8s %8s %8s %8s %8s %8s %8s %8s\n" "シナリオ" "作成時間" "メモリ" "選択時間" "PA時間" "保存時間" "VP時間" "GC時間" "FPS"
format "%-15s %8s %8s %8s %8s %8s %8s %8s %8s\n" "-------" "------" "----" "------" "------" "------" "------" "------" "-----"
for result in results do
(
format "%-15s %8.3fs %7.1fMB %8.3fs %8.3fs %8.3fs %8.3fs %8.3fs %8.1f\n" \
result[2] result[3] result[4] result[5] result[6] result[7] result[8] result[9] result[10]
)
-- 比較分析
if results.count >= 2 then
(
format "\n=== 比較分析(Base比) ===\n"
local baseResult = results[1] -- Base結果
for i = 2 to results.count do
(
local currentResult = results[i]
format "\n📊 %:\n" currentResult[2]
-- 各指標の比較(Base = 100%として)
local creationRatio = (currentResult[3] / baseResult[3]) * 100
local memoryRatio = (currentResult[4] / baseResult[4]) * 100
local selectionRatio = (currentResult[5] / baseResult[5]) * 100
local fpsRatio = if baseResult[10] > 0 then (currentResult[10] / baseResult[10]) * 100 else 100
format " 作成時間: %.1f%% (%s)\n" creationRatio (if creationRatio > 100 then "遅い" else "速い")
format " メモリ: %.1f%% (%s)\n" memoryRatio (if memoryRatio > 100 then "多い" else "少ない")
format " 選択時間: %.1f%% (%s)\n" selectionRatio (if selectionRatio > 100 then "遅い" else "速い")
format " FPS: %.1f%% (%s)\n" fpsRatio (if fpsRatio < 100 then "遅い" else "速い")
)
)
format "\n=== ベンチマーク終了 ===\n"
)
-- 実行
runComprehensiveBenchmark()
シナリオ 作成時間 メモリ 選択時間 PA時間 保存時間 VP時間 GC時間 FPS
------- ------ ---- ------ ------ ------ ------ ------ -----
Base (CA無し) 0.234s 45.2MB 0.012s 0.000s 0.089s 0.034s 0.002s 45.2
Light UI 0.267s 46.8MB 0.015s 0.003s 0.095s 0.035s 0.002s 43.1
Heavy UI 0.445s 52.1MB 0.028s 0.012s 0.128s 0.041s 0.003s 38.7
この包括的なベンチマークにより、カスタムアトリビュートが3ds Maxの様々な側面に与える影響を詳細に分析できます。