Thread Rating:
  • 664 Vote(s) - 2.83 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RecordGrid のパフォーマンスについて
01-06-2014, 02:34 PM, (This post was last modified: 01-06-2014, 02:53 PM by umemura.)
#9
RE: RecordGrid のパフォーマンスについて
RecordGrid.batch-events?=true を指定するのとしないのとでは、かなりパフォーマンスに影響がありますね。

また、別スレッドの「セル単位での色指定」でも記載しましたが、
RecordGridCell.refresh-data の中で、このbatch-events?を参照するようにすると、
さらに全体のパフォーマンスが向上しました。


Code:
{curl 8.0 applet}
{curl-file-attributes character-encoding = "utf8"}
{applet manifest = "manifest.mcurl",
    {compiler-directives careful? = true}
}


{define-class public open CustomCell
  {inherits StandardStringCell }
  {constructor public {default}
    {construct-super}
  }

  {method public open {refresh-data}:void
    ||RecordSet.batch-events?=true の間は、
    ||再描画処理を行わない
    {if-non-null record = self.record,
        rs = self.record.record-set
    then
        {if not rs.batch-events? then
            {super.refresh-data}
            let (data:String, valid?:bool) = {self.get-formatted-data}
            {if {data.to-int} > 10  then
                set self.background = "pink"
             else
                {unset self.background}
            }
        }
    }
  }
}

{define-class public open CustomCell2
  {inherits StandardStringCell }
  {constructor public {default}
    {construct-super}
  }

  {method public open {refresh-data}:void
    {super.refresh-data}
    let (data:String, valid?:bool) = {self.get-formatted-data}
    {if {data.to-int} > 10  then
        set self.background = "pink"
    else
        {unset self.background}
    }
  }
}

{def rf-ary = {{Array-of RecordField}}}
{def col-ary = {{Array-of RecordGridColumn}}}
{def col-ary2 = {{Array-of RecordGridColumn}}}
{for i:int = 1 to 100 do
    def rf-name = "field-" & i
    {rf-ary.append {RecordField rf-name}}
    {col-ary.append {RecordGridColumn rf-name, cell-spec = CustomCell}}
    {col-ary2.append {RecordGridColumn rf-name, cell-spec = CustomCell2}}
}
{def rs = {RecordSet {RecordFields {splice rf-ary}}}}
{def rs2 = {RecordSet {RecordFields {splice rf-ary}}}}

{def grid =
    {RecordGrid
        height = 5in, width = 3in,
        record-source = rs
        , {splice col-ary}
    }
}
{def grid2 =
    {RecordGrid
        height = 5in, width = 3in,
        record-source = rs2
        , {splice col-ary2}
    }
}


||レコードの作成
{define-proc public {init-record rs:RecordSet}:void
    {rs.delete-all}
    {rs.commit}
    {for i:int = 0 to 5000 do
        def new-r = {rs.new-record}
        {for rf in rs.fields do
            set new-r[rf.name] = {String i}
        }
        {rs.append new-r}
    }
}

{CommandButton
    label = "クリア",
    {on Action do
        {rs.delete-all}
        {rs.commit}
        {rs2.delete-all}
        {rs2.commit}
    }
}

{HBox
    {VBox
        "refresh-data を ",
        "batch-event?=true 時にキャンセルする",
        {HBox

            {CommandButton
                label = "batch-events?あり",
                {on Action do
                    ||def dt = {DateTime}
                    {with rs.batch-events? = true do
                        {init-record rs}
                    }
                    ||{popup-message {dt.elapsed}}
                }
            },
            {CommandButton
                label = "batch-events?なし",
                {on Action do
                    ||def dt = {DateTime}
                    {init-record rs}
                    ||{popup-message {dt.elapsed}}
                }
            }
        },
        grid
    },
    {VBox
        "refresh-data を ",
        "常に処理する",
        {HBox
            {CommandButton
                label = "batch-events?あり",
                {on Action do
                    ||def dt = {DateTime}
                    {with rs.batch-events? = true do
                        {init-record rs2}
                    }
                    ||{popup-message {dt.elapsed}}
                }
            },
            {CommandButton
                label = "batch-events?なし",
                {on Action do
                    ||def dt = {DateTime}
                    {init-record rs2}
                    ||{popup-message {dt.elapsed}}
                }
            }
        }
        , grid2
    }
}


Messages In This Thread
RE: RecordGrid のパフォーマンスについて - by umemura - 01-06-2014, 02:34 PM

Possibly Related Threads...
Thread Author Replies Views Last Post
  RecordGrid の行の実際の高さの調べ方 kay 2 3,117 03-01-2016, 06:14 PM
Last Post: kay
  RecordGrid でDropdownList を表示 umemura 10 14,859 06-30-2015, 06:52 PM
Last Post: dyoshida
  RecordGrid 列の表示/非表示について Yudai-s 2 4,383 05-19-2015, 06:54 PM
Last Post: Yudai-s
  RecordGrid のセル単位のフォーカス制御方法 kay 2 3,286 03-06-2015, 06:34 PM
Last Post: kay
  RecordGrid のセルのフォーカス可否制御 kay 2 3,579 03-02-2015, 07:56 PM
Last Post: kay
  RecordGrid の縦のスクロールバー umemura 3 5,154 01-20-2014, 10:38 AM
Last Post: umemura
  RecordGrid の NavigationPanel について umemura 2 5,117 08-23-2011, 08:52 AM
Last Post: c-s
  RecordGrid で オートコンプリート umemura 1 4,744 07-29-2011, 10:58 PM
Last Post: umemura
  RecordGrid での右詰め umemura 3 6,012 07-29-2011, 01:32 PM
Last Post: c-s
Forum Jump:


Users browsing this thread:
2 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
Query:
INSERT INTO mybb_threadviews (tid) VALUES('232')