Bug 144483 - Clean up: Remove unnecessary runtime computation of string length
Summary: Clean up: Remove unnecessary runtime computation of string length
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-30 18:27 PDT by Daniel Bates
Modified: 2015-05-01 12:03 PDT (History)
3 users (show)

See Also:


Attachments
Patch (1.79 KB, patch)
2015-04-30 18:29 PDT, Daniel Bates
joepeck: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2015-04-30 18:27:37 PDT
Following <http://trac.webkit.org/changeset/183649>, WebCore::fullyQualifiedInfoTableName() computes the strlen() of a string literal as part of concatenating two string literals. Notice that the size of a string literal is known at compile time. It is sufficient to use sizeof() - 1 instead of strlen() to compute the string length of the string literal.
Comment 1 Daniel Bates 2015-04-30 18:29:16 PDT
Created attachment 252127 [details]
Patch
Comment 2 Joseph Pecoraro 2015-04-30 19:39:04 PDT
Comment on attachment 252127 [details]
Patch

r=me
Comment 3 Daniel Bates 2015-04-30 19:41:51 PDT
Committed r183663: <http://trac.webkit.org/changeset/183663>
Comment 4 Darin Adler 2015-05-01 12:03:24 PDT
Comment on attachment 252127 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=252127&action=review

> Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp:100
> -        strcpy(qualifiedName + strlen(qualifier), unqualifiedInfoTableName);
> +        strcpy(qualifiedName + sizeof(qualifier) - 1, unqualifiedInfoTableName);

This change is unnecessary for clang or gcc since they already constant-fold this. So in practice this is a at most a Windows-only optimization.