Summary: | Optimize StringImpl::lower() for 8-bit strings | ||
---|---|---|---|
Product: | WebKit | Reporter: | Ahmad Saleem <ahmad.saleem792> |
Component: | New Bugs | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW --- | ||
Severity: | Normal | CC: | ap, cdumez, darin, koivisto, webkit-bug-importer |
Priority: | P2 | Keywords: | InRadar |
Version: | Safari Technology Preview | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Description
Ahmad Saleem
2022-12-13 05:37:44 PST
This microbenchmark being 3-4x faster in Chromium is an excellent opportunity for optimization. The StringImpl::lower part is a very small part of this (was 12% at the time they did it) but could still be a worthwhile thing to tighten up. Not sure we would want *exactly* what they did in Chromium since the most important case to optimize is probably no uppercase letters at all followed by all ASCII. I profiled this benchmark and don't see any lowercasing near the top: ``` Sample Count, Samples %, Normalized CPU %, Symbol 19352, 30.2%, 8.4%, com.apple.WebKit (63672) 3114, 4.9%, 1.3%, WebCore::Style::ElementRuleCollector::collectMatchingRules(WebCore::Style::MatchRequest const&) (in WebCore) 1766, 2.8%, 0.8%, WebCore::Style::Invalidator::invalidateStyleForDescendants(WebCore::Element&, WebCore::Style::SelectorMatchingState*) (in WebCore) 1245, 1.9%, 0.5%, WTF::fastMalloc(unsigned long) (in JavaScriptCore) 1225, 1.9%, 0.5%, WTF::Vector<WebCore::Style::MatchedProperties, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>::~Vector() (in WebCore) 1204, 1.9%, 0.5%, pas_thread_local_cache_flush_deallocation_log (in JavaScriptCore) 1128, 1.8%, 0.5%, WebCore::Style::ElementRuleCollector::~ElementRuleCollector() (in WebCore) 1010, 1.6%, 0.4%, WTF::fastFree(void*) (in JavaScriptCore) 975, 1.5%, 0.4%, WebCore::SelectorFilter::pushParent(WebCore::Element*) (in WebCore) 944, 1.5%, 0.4%, WebCore::Style::Invalidator::invalidateIfNeeded(WebCore::Element&, WebCore::Style::SelectorMatchingState*) (in WebCore) 756, 1.2%, 0.3%, WebCore::Style::ElementRuleCollector::collectMatchingRules(WebCore::Style::CascadeLevel) (in WebCore) 746, 1.2%, 0.3%, WebCore::Style::ElementRuleCollector::ElementRuleCollector(WebCore::Element const&, WebCore::Style::RuleSet const&, WebCore::Style::SelectorMatchingState*) (in WebCore) 604, 0.9%, 0.3%, WebCore::Style::ElementRuleCollector::collectMatchingRulesForList(WTF::Vector<WebCore::Style::RuleData, 1ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc> const*, WebCore::Style::MatchRequest const&) (in WebCore) 528, 0.8%, 0.2%, WebCore::Style::ElementRuleCollector::matchesAnyAuthorRules() (in WebCore) 390, 0.6%, 0.2%, WebCore::SelectorFilter::popParent() (in WebCore) 223, 0.3%, 0.1%, WebCore::NodeTraversal::nextAncestorSibling(WebCore::Node const&, WebCore::Node const*) (in WebCore) 220, 0.3%, 0.1%, DYLD-STUB$$WTF::fastFree(void*) (in WebCore) 162, 0.3%, 0.1%, WebCore::Node::containingShadowRoot() const (in WebCore) 149, 0.2%, 0.1%, WebCore::LayoutRect::intersects(WebCore::LayoutRect const&) const (in WebCore) 131, 0.2%, 0.1%, DYLD-STUB$$WTF::fastMalloc(unsigned long) (in WebCore) 122, 0.2%, 0.1%, _platform_memmove (in libsystem_platform.dylib) 97, 0.2%, 0.0%, WebCore::ScrollingStateNode::indexOfChild(WebCore::ScrollingStateNode&) const (in WebCore) 94, 0.1%, 0.0%, WebCore::accumulateOffsetTowardsAncestor(WebCore::RenderLayer const*, WebCore::RenderLayer const*, WebCore::LayoutPoint&, WebCore::RenderLayer::ColumnOffsetAdjustment) (in WebCore) 73, 0.1%, 0.0%, bmalloc_heap_config_specialized_local_allocator_try_allocate_small_segregated_slow (in JavaScriptCore) 44, 0.1%, 0.0%, WebCore::RectList::intersects(WebCore::LayoutRect const&) const (in WebCore) ``` |