ColdFusion: More efficient structKeyExists() instead of isDefined()

后端 未结 2 1145
清歌不尽
清歌不尽 2021-01-03 20:35

Which of these is more efficient in ColdFusion?

isDefined(\'url.myvar\')

or

structKeyExists(url, \'myvar\')
2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-03 21:29

    Use the one which is easier to read and best shows what you're doing.

    The difference between the two is incredibly small, and very likely not worth worrying about at all.

    Don't waste time optimising code unless you have a proven and repeatable test case which demonstrates the slowness.

提交回复
热议问题