XSLT Performance

后端 未结 3 921
一向
一向 2020-12-17 01:04

I am working for a project which has many XSLT transformations. The transformations have to be as fast as possible.

For readability I wrote many of them dividing \"b

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-17 01:34

    Saving the result of function application to a variable isn't going to have any significant impact on performance in the general case (and some XSLT processors such as Saxon use lazy evaluation, so the function will not be evaluated untill the variable is actually needed).

    On the contrary, if the function must be evaluated more than once with the same parameters, saving the result in a variable can result in some cases in significant increase of efficiency.

    The correct way to improve performance is:

    1. Profile/measure to identify real bottlenecks.

    2. Optimize only the biggest bottlenecks.

    3. If there is still need for increased performance, start a new iteration, going to 1. above.

    To quote Donald Knuth: "Premature optimization is the root of all evil" -- which is actually a paraphrase of the wellknown saying: "The road to hell is paved with good intentions."

提交回复
热议问题