Rust编写的JavaScript引擎,该项目是一个试验性质的项目。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

1.4 KiB

Profiling

Example

It's possible to get a full profile of Boa in action.
Sometimes this is needed to figure out where it is spending most of it's time.

We use a crate called measureme, which helps us keep track of timing functions during runtime.

When the "profiler" flag is enabled, you compile with the profiler and it is called throughout the interpreter.
when the feature flag is not enabled, you have an empty dummy implementation that is just no ops. rustc should completely optimize that away. So there should be no performance downgrade from these changes

Prerequesites

How To Use

You can run boa using the "profiler" feature flag to enable profiling. Seeing as you'll most likely be using boa_cli you can pass this through, like so:

cargo run --features Boa/profiler ../tests/js/test.js

Once finished you should see some trace files left in the directory (boa_cli in this case).
In the same directory as the .events, string_data, string_index files run crox my_trace or whatever the name of the files are. This will generate a chrome_profiler.json file, you can load this into Chrome Dev tools.

More Info