Is PsiElement.copy() expensive?

Hi

Is PsiElement.copy() expensive? I'm asking because the JavaDoc on this method says 'Creates a copy of the file containing the PSI element and returns the corresponding element in the created copy.'

What if it's a 'big' file? Or is this something I don't have to worry about?

--Etienne

2 comments

Hello etienne,

e> Is PsiElement.copy() expensive? I'm asking because the JavaDoc on
e> this method says 'Creates a copy of the file containing the PSI
e> element and returns the corresponding element in the created copy.'
e>
e> What if it's a 'big' file? Or is this something I don't have to worry
e> about?

This behavior has been changed in version 5.1. In 5.0, indeed a copy of the
file was created, and it could be an expensive operation. In 5.1, only a
copy of the element and its children is created.

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0

Hi Dmitry

Sounds good.
Thanks for your explanation!

-Etienne

0

Please sign in to leave a comment.