Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2384)

Unified Diff: Source/platform/fonts/SimpleFontData.cpp

Issue 227473005: Performance related change, Optimization for / and % operator. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/SimpleFontData.cpp
diff --git a/Source/platform/fonts/SimpleFontData.cpp b/Source/platform/fonts/SimpleFontData.cpp
index da13c13985b10d54f2ae08a6f0b9b2a019ead071..e358899123dbe87c480fe1fd27dcd87364d79326 100644
--- a/Source/platform/fonts/SimpleFontData.cpp
+++ b/Source/platform/fonts/SimpleFontData.cpp
@@ -160,8 +160,10 @@ const SimpleFontData* SimpleFontData::fontDataForCharacter(UChar32) const
Glyph SimpleFontData::glyphForCharacter(UChar32 character) const
{
- GlyphPageTreeNode* node = GlyphPageTreeNode::getRootChild(this, character / GlyphPage::size);
- return node->page() ? node->page()->glyphAt(character % GlyphPage::size) : 0;
+ // As GlyphPage::size is power of 2 so shifting is valid
+ int val = character >> 8;
jungshik at Google 2014/04/07 17:13:58 Hmm... compiler was not smart enough? (GlyphPage:
Stephen Chennney 2014/04/07 18:02:49 This hard bakes GlyphPage::size to 256. At a mini
hj 2014/04/08 02:56:50 Okey, will make changes. as per the shared links w
+ GlyphPageTreeNode* node = GlyphPageTreeNode::getRootChild(this, val);
+ return node->page() ? node->page()->glyphAt(character - (val << 8)) : 0;
Stephen Chennney 2014/04/07 18:02:49 character - (val << 8) would be better implemented
hj 2014/04/08 02:56:50 Thank you, will make required changes. On 2014/04
}
bool SimpleFontData::isSegmented() const
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698