#2550 closed enhancement (fixed)
Try removing with() from offset.
Reported by: | flesler | Owned by: | brandon |
---|---|---|---|
Priority: | minor | Milestone: | 1.2.4 |
Component: | offset | Version: | 1.2.3 |
Keywords: | offset with | Cc: | |
Blocked by: | Blocking: |
Description
Maybe, removing the with() call from offset() can improve its perfomance. The saving in bytes is really small, so if it does hit on perfomance, then it might be better to remove it.
Attachments (3)
Change History (6)
Changed 15 years ago by
Attachment: | offset.diff added |
---|
Changed 15 years ago by
Attachment: | offset-curCSS-getComp.diff added |
---|
Replacing css for curCSS inside offset, caching getComputedStyle
comment:1 Changed 15 years ago by
I made some real tests, the with() didn't seem to matter much. I tried replacing jQuery.css for jQuery.curCSS because that was a useless call. The time got lower and saved many calls. Then cached document.defaultView && document.defaultView.getComputedStyle in a var, and that reduced the time. I tried all this many many times back and forth to discard CPU interferences. The element that I called offset on, had 7 parents, and then the body. The latter was its third offsetParent.
Regular Profile (21359.375ms, 186011 calls) offset(500 times) - attempt 1: 5359ms test.js (line 17) offset(500 times) - attempt 2: 5406ms test.js (line 17) offset(500 times) - attempt 3: 5359ms test.js (line 17) offset(500 times) - attempt 4: 5297ms curCSS 4 css Profile (20296.875ms, 148011 calls) offset(500 times) - attempt 1: 5093ms test.js (line 17) offset(500 times) - attempt 2: 5000ms test.js (line 17) offset(500 times) - attempt 3: 5109ms test.js (line 17) offset(500 times) - attempt 4: 5109ms curCSS 4 css, defaultView cached Profile (16203.125ms, 148011 calls) offset(500 times) - attempt 1: 3984ms test.js (line 17) offset(500 times) - attempt 2: 3969ms test.js (line 17) offset(500 times) - attempt 3: 4078ms test.js (line 17) offset(500 times) - attempt 4: 4203ms
comment:2 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
with() removed, jQuery browser is cached into a variable