このMAXSCRIPTをちゃんと機能するようにしてくれ
-- ① カスタムアトリビュート定義（CA）
fn defineCA caType =
(
    case caType of
    (
        #light:
        (
            attributes LightAttr (
                parameters p rollout:ui (
                    sp type:#float default:0
                )
                rollout ui "Light UI" (
                    spinner s "Value:" range:[0,100,0]
                )
            )
        )
        #heavy:
        (
            attributes HeavyAttr (
                parameters p rollout:ui (
                    dummy type:#float
                )
                rollout ui "Heavy UI" (
                    angle a "Angle" width:80 across:2 degrees:45 align:#left
                    slider s "Slider:" orient:#vertical
                    spinner sp "Spinner:"
                    group "Group" (
                        button b "Button" across:2 width:80 align:#left
                        checkbutton cb "Checkbutton" width:80 align:#right
                        mapbutton mb "Map Button" width:80 across:2 align:#left
                        materialbutton mb2 "Material Button" width:80 align:#right
                        pickbutton pb "Pickbutton:" width:80
                    )
                    checkbox ch "Checkbox" across:2 offset:[0,2]
                    colorpicker cp "Colorpicker:"
                    listbox lb "Listbox:" items:#("Item 1","Item 2") height:3 width:80 across:2
                    multilistbox mlb "Multilistbox:" items:#("Item 1","Item 2") height:3 width:80
                    dropdownlist ddl "DropDownList:" items:#("Item 1","Item 2") width:80 across:2
                    combobox cbx "Combobox:" items:#("Item 1","Item 2") height:3 width:80
                    edittext et "Edittext:"
                    hyperlink hl "Hyperlink" url:"http://www.autodesk.com" color:red across:2 offset:[10,20]
                    label l "Label" offset:[0,20]
                    groupBox gb "Groupbox:" height:40 offset:[0,-40] width:174
                    progressbar pb2 "Progressbar:" value:50
                    radiobuttons rb "Radio Buttons" labels:#("Option 1","Option 2")
                    bitmap bm "Bitmap" width:80 height:50 bitmap:(bitmap 80 50 color:red) align:#left across:2
                    imgTag it "Bitmap" width:80 height:50 bitmap:(bitmap 80 50 color:green) align:#right
                    curvecontrol cc "Curvecontrol:" height:150
                )
            )
        )
        default: undefined
    )
)

-- ② 1000 体のヘルパーを生成する関数
fn generateHelpers count attr =
(
    local helpers = #()
    for i = 1 to count do
    (
        local h = point name:("H" + i as string) pos:[mod i 100 * 10, floor(i/100)*10, 0]
        if (attr != undefined and iskindof attr MSCustAttribDef) then
        (
            local attrHold = emptyModifier()
            attrHold.name = "Attribute Holder"
            addmodifier h attrHold
            custAttributes.add h.modifiers[#Attribute_Holder] attr
        )
        append helpers h
    )
    return helpers
)

-- ③ 擬似 FPS を測定する関数
fn measureFPS redrawCount =
(
    local tStart = timestamp()
    for i = 1 to redrawCount do
        redrawViews()
    local tEnd = timestamp()
    local elapsedSec = (tEnd - tStart) / 1000.0
    if elapsedSec == 0 then (
        format "警告：経過時間がゼロです。測定値は不正確です。\n"
        return 0
    )
    local fps = redrawCount / elapsedSec
    return fps
)

-- 例: 500回測定



-- ④ 一括ベンチマーク実行関数
fn runAllBenchmarks =
(
    clearListener()
    format "=== ベンチマーク開始 ===\n\n"

    -- ----- ベース：空のヘルパーのみ（CA なし） -----
    format "🌿 Base (空のヘルパー)\n"
    resetMaxFile #noPrompt
    disableSceneRedraw()
    generateHelpers 1000 undefined   -- CA を付けない
    enableSceneRedraw()
    sleep 1.0
    local fpsBase = measureFPS 50
    format "FPS (Base): %.2f\n\n" fpsBase

    -- ----- Light UI：最小構成の CA（スピナーのみ） -----
    format "🌱 Light UI (最小のカスタム属性)\n"
    resetMaxFile #noPrompt
    disableSceneRedraw()
    local lightCA = defineCA #light
    generateHelpers 1000 lightCA
    enableSceneRedraw()
    sleep 1.0
    local fpsLight = measureFPS 50
    format "FPS (Light UI): %.2f\n\n" fpsLight

    -- ----- Heavy UI：多数の UI 部品を含む CA -----
    format "🌳 Heavy UI (大量UI付きカスタム属性)\n"
    resetMaxFile #noPrompt
    disableSceneRedraw()
    local heavyCA = defineCA #heavy
    generateHelpers 1000 heavyCA
    enableSceneRedraw()
    sleep 1.0
    local fpsHeavy = measureFPS 50
    format "FPS (Heavy UI): %.2f\n" fpsHeavy

    format "\n=== ベンチマーク終了 ===\n"
)

-- ⑤ ベンチマーク実行
runAllBenchmarks()