Changeset 59061 in webkit for trunk/JavaScriptCore
- Timestamp:
- May 9, 2010, 2:16:16 PM (15 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r59060 r59061 1 2010-05-09 Geoffrey Garen <[email protected]> 2 3 Reviewed by Oliver Hunt. 4 5 Reserve a large-ish initial capacity for Lexer::m_buffer16. 6 7 SunSpider says 0.3% faster. 8 9 m_buffer16 is used when parsing complex strings -- for example, strings 10 with escape sequences in them. These kinds of strings can be really long, 11 and we want to avoid repeatedly copying as we grow m_buffer16. 12 13 The net memory cost is quite low, since it's proporitional to source 14 code we already have in memory, and we throw away m_buffer16 right when 15 we're done parsing. 16 17 * parser/Lexer.cpp: 18 (JSC::Lexer::Lexer): No need to reserve initial capacity in our constructor, 19 since setCode will be called before we're asked to lex anything. 20 (JSC::Lexer::setCode): Reserve enough space to lex half the source code 21 as a complex string without having to copy. 22 (JSC::Lexer::clear): No need to reserve initial capacity here either, 23 since setCode will be called before we're asked to lex anything. 24 1 25 2010-05-09 Laszlo Gombos <[email protected]> 2 26 -
trunk/JavaScriptCore/parser/Lexer.cpp
r53224 r59061 53 53 , m_keywordTable(JSC::mainTable) 54 54 { 55 m_buffer8.reserveInitialCapacity(initialReadBufferCapacity);56 m_buffer16.reserveInitialCapacity(initialReadBufferCapacity);57 55 } 58 56 … … 149 147 m_error = false; 150 148 m_atLineStart = true; 149 150 m_buffer8.reserveInitialCapacity(initialReadBufferCapacity); 151 m_buffer16.reserveInitialCapacity((m_codeEnd - m_code) / 2); 151 152 152 153 // ECMA-262 calls for stripping all Cf characters, but we only strip BOM characters. … … 1010 1011 1011 1012 Vector<char> newBuffer8; 1012 newBuffer8.reserveInitialCapacity(initialReadBufferCapacity);1013 1013 m_buffer8.swap(newBuffer8); 1014 1014 1015 1015 Vector<UChar> newBuffer16; 1016 newBuffer16.reserveInitialCapacity(initialReadBufferCapacity);1017 1016 m_buffer16.swap(newBuffer16); 1018 1017
Note:
See TracChangeset
for help on using the changeset viewer.