Bug 103331 - [V8] Replace toWebCoreString()/toWebCoreAtomicString() with V8Parameter
Summary: [V8] Replace toWebCoreString()/toWebCoreAtomicString() with V8Parameter
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kentaro Hara
URL:
Keywords:
Depends on: 103340 103341 103367 103391 103397 103404
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-26 17:23 PST by Kentaro Hara
Modified: 2014-12-16 00:48 PST (History)
1 user (show)

See Also:


Attachments
micro benchmarks (1.92 KB, text/html)
2012-11-26 17:53 PST, Kentaro Hara
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kentaro Hara 2012-11-26 17:23:14 PST
V8ParameterBase is slow. V8ParameterBase is being used in hot call paths.

  // Code A
  AtomicString str = toWebCoreAtomicString(v8Object); // Assume that v8Object is v8::String or v8::Int32
  imp->setAttribute(HTMLNames::idAttr, str);

  // Code B
  STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str, v8Object); // Assume that v8Object is v8::String or v8::Int32
  imp->setAttribute(HTMLNames::idAttr, str);

Code B is 10% slower than Code A. Ideally Code A should be as fast as Code B.

Then we can replace all toWebCoreAtomicString()s and toWebCoreString()s with V8ParameterBase; i.e. we can always use V8ParameterBase regardless of String or AtomicString.
Comment 1 Kentaro Hara 2012-11-26 17:53:38 PST
Created attachment 176130 [details]
micro benchmarks

Hmm, it looks like 10% slowness was placebo. The perf is a bit flaky.

As far as I test with the micro benchmarks attached to this bug and Bindings/id-setter.html a lot of times, there is no observable perf diff between V8Parameter and toWebCoreString()/toWebCoreAtomicString().

So the conclusion is that V8Parameter is as fast as toWebCoreString()/toWebCoreAtomicString(), and thus we can replace toWebCoreString()/toWebCoreAtomicString() with V8Parameter without regressing performance.
Comment 2 Brian Burg 2014-12-16 00:48:03 PST
Closing some V8-related work items.