DOM Performance Tip - adoptNode

DOM Level 3 introduced adoptNode which allows you to adopt a node from another document to this document. This effectively allows moving a subtree from one document to another (unlike importNode() which create a copy of the source node instead of moving it). adoptNode is much more performance efficient than importNode especially for deep Nodes since it avoids the creation and copying overheads. My experiments using XMLTest (with UBL Invoice document) showed a performance improvement of about 25%. Note that this large performance improvement is for a microbenchmark, improvement for your application may vary.
Comments:

Post a Comment:
Comments are closed for this entry.
About

binu

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today