Closed
Bug 564980
Opened 16 years ago
Closed 16 years ago
[FIX]Use JSString::length directly instead of via JS_GetStringLength
Categories
(Core :: XPConnect, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
|
3.02 KB,
patch
|
mrbkap
:
review+
|
Details | Diff | Splinter Review |
That should save us the function call overhead on hot paths.
| Assignee | ||
Comment 1•16 years ago
|
||
Attachment #444591 -
Flags: review?(mrbkap)
Comment 2•16 years ago
|
||
Comment on attachment 444591 [details] [diff] [review]
Like so
+ nsDependentString(reinterpret_cast<const PRUnichar *>(::JS_GetStringChars(str)),
+ str->length())
Any reason not to replace the JS_GetStringChars() call with str->chars() as well (which this bug seems to be primarily about)?
Comment 3•16 years ago
|
||
Comment on attachment 444591 [details] [diff] [review]
Like so
I have the same question as jst -- either this bug is mistitled, or there's more function call overhead to nuke here.
Attachment #444591 -
Flags: review?(mrbkap)
| Assignee | ||
Comment 4•16 years ago
|
||
Just looked over the profiles again. I'd started with JS_GetStringChars (which showed up more than JS_GetStringLength), then realized that I can't just call chars() because I can't link to js_GetDependentStringChars (it's not exported) and just converted JS_GetStringLength.
I suppose I can retitle or we can wontfix or whatever. Or make js_GetDependentStringChars a friend API?
Comment 5•16 years ago
|
||
Comment on attachment 444591 [details] [diff] [review]
Like so
I guess that we might as well do this... It can't hurt any more than our existing uses of friendly APIs.
Attachment #444591 -
Flags: review+
| Assignee | ||
Updated•16 years ago
|
Summary: [FIX]Use JSString::chars directly instead of via JS_GetStringChars → [FIX]Use JSString::length directly instead of via JS_GetStringLength
| Assignee | ||
Comment 6•16 years ago
|
||
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•