developit / undom

🍩 1kb minimally viable DOM Document implementation
https://npm.im/undom
MIT License
662 stars 25 forks source link

Further improve performance of Document creation. #26

Open bmeurer opened 5 years ago

bmeurer commented 5 years ago

This speeds up the create test by about 25-30% by avoiding the call to util.assign() in the createDocument() function. Instead of that Document#document is now an accessor on the prototype, defaultView is an instance of a new DefaultView class, whose instances have links to the document, and finally the interesting constructors that are exposed via Document instances are all installed on the Document and DefaultView prototypes instead of the instances.