catapult
Deprecated Catapult GitHub. Please instead use http://crbug.com "Speed>Benchmarks" component for bugs and https://chromium.googlesource.com/catapult for downloading and editing source code..
Top Related Projects
The official GitHub mirror of the Chromium source
A microbenchmark support library
PerfView is a CPU and memory performance-analysis tool
Stack trace visualizer
APM, Application Performance Monitoring System
Quick Overview
Catapult is a performance analysis and benchmarking platform for web applications and browsers. It provides a suite of tools for measuring, debugging, and improving web performance, including Trace Event Profiling, Performance Dashboard, and Telemetry.
Pros
- Comprehensive suite of performance analysis tools
- Integrates well with Chrome and other Chromium-based browsers
- Open-source and actively maintained by Google
- Supports both manual and automated performance testing
Cons
- Steep learning curve for new users
- Documentation can be fragmented and sometimes outdated
- Primarily focused on Chrome/Chromium, with limited support for other browsers
- Setup and configuration can be complex for some components
Code Examples
As Catapult is not primarily a code library but a collection of tools, traditional code examples are not applicable. However, here are some command-line examples for using Catapult components:
- Running a Telemetry benchmark:
./run_benchmark run smoothness.top_25_smooth
- Using the trace viewer:
./tracing/bin/trace2html my_trace.json
- Running a Web Page Replay archive:
./web_page_replay_go/src/wpr.py record --archive_path=archive.wprgo http://example.com
Getting Started
To get started with Catapult:
-
Clone the repository:
git clone https://github.com/catapult-project/catapult.git
-
Install dependencies:
cd catapult ./bin/run_dev_server_tests --install-hooks
-
Run the development server:
./bin/run_dev_server
-
Access the Catapult tools through your browser at
http://localhost:8000
.
For more detailed instructions on specific tools, refer to the documentation in the respective subdirectories of the Catapult project.
Competitor Comparisons
The official GitHub mirror of the Chromium source
Pros of Chromium
- Larger, more comprehensive project with a broader scope
- More active development and frequent updates
- Extensive documentation and community support
Cons of Chromium
- Higher complexity and steeper learning curve
- Requires more resources to build and run
- Larger codebase may be overwhelming for new contributors
Code Comparison
Catapult (Python):
def _GetChromiumSrcDir():
return os.path.abspath(os.path.join(
os.path.dirname(__file__), '..', '..', '..', '..', '..'))
Chromium (C++):
bool ChromeContentBrowserClient::CanCreateWindow(
content::RenderFrameHost* opener,
const GURL& opener_url,
const GURL& opener_top_level_frame_url,
const url::Origin& source_origin,
content::mojom::WindowContainerType container_type,
const GURL& target_url,
const content::Referrer& referrer,
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& features,
bool user_gesture,
bool opener_suppressed,
bool* no_javascript_access) {
// Implementation details...
}
The code snippets highlight the difference in complexity and language choices between the two projects. Catapult uses Python for simplicity and ease of use, while Chromium employs C++ for performance and low-level control.
A microbenchmark support library
Pros of Benchmark
- Focused specifically on microbenchmarking C++ code
- Easier to set up and use for simple benchmarking tasks
- More actively maintained with frequent updates
Cons of Benchmark
- Limited to C++ benchmarking, while Catapult supports multiple languages
- Lacks advanced visualization and analysis tools provided by Catapult
- Doesn't offer system-wide performance monitoring capabilities
Code Comparison
Benchmark example:
static void BM_StringCreation(benchmark::State& state) {
for (auto _ : state)
std::string empty_string;
}
BENCHMARK(BM_StringCreation);
Catapult example (using Telemetry):
def MeasurePageLoadTime(action_runner):
action_runner.Navigate('http://www.example.com')
action_runner.WaitForJavaScriptCondition('performance.timing.loadEventEnd > 0')
load_time = action_runner.EvaluateJavaScript(
'performance.timing.loadEventEnd - performance.timing.navigationStart')
return {'load_time': load_time}
Both repositories serve different purposes, with Benchmark focusing on C++ microbenchmarking and Catapult offering a more comprehensive performance testing and analysis toolkit for web applications and systems.
PerfView is a CPU and memory performance-analysis tool
Pros of PerfView
- Focused on Windows performance analysis with deep .NET integration
- Provides a rich GUI for data visualization and analysis
- Offers powerful trace merging and diff capabilities
Cons of PerfView
- Limited cross-platform support compared to Catapult
- Steeper learning curve for non-Windows developers
- Less extensive web performance tooling
Code Comparison
PerfView (C#):
public static void Main(string[] args)
{
CommandLineArgs parsedArgs = new CommandLineArgs(args);
if (parsedArgs.HelpRequested)
CommandLineArgs.DisplayHelp();
else
App.Main();
}
Catapult (Python):
def main(args):
parser = argparse.ArgumentParser(description='Catapult')
parser.add_argument('command', help='Command to run')
parsed_args = parser.parse_args(args)
if parsed_args.command == 'run':
run_catapult()
Both repositories provide performance analysis tools, but they cater to different ecosystems. PerfView excels in Windows and .NET environments, offering detailed insights through its GUI. Catapult, on the other hand, is more versatile across platforms and focuses on web performance. The code snippets highlight the different languages and approaches used in each project.
Stack trace visualizer
Pros of FlameGraph
- Lightweight and focused tool specifically for generating flame graphs
- Easy to use with various profiling tools and data formats
- Highly portable, written in Perl with minimal dependencies
Cons of FlameGraph
- Limited to flame graph generation, lacks broader performance analysis features
- Requires external profiling tools to generate input data
- Less integrated development environment compared to Catapult
Code Comparison
FlameGraph (stackcollapse-perf.pl):
while (<>) {
chomp;
if (/^(\w+)\s*(.+)/) {
my ($pid, $stack) = ($1, $2);
$stack =~ s/;*\s+[0-9]+//g;
print "$pid;$stack 1\n";
}
}
Catapult (trace_event.py):
def WriteTraceEventCommon(trace_event_file, event):
"""Writes a trace event to the given file."""
event_dict = {
'name': event.name,
'cat': event.category,
'ph': event.phase,
'ts': event.timestamp,
'pid': event.process_id,
'tid': event.thread_id,
}
json.dump(event_dict, trace_event_file)
trace_event_file.write('\n')
Summary
FlameGraph is a specialized tool for generating flame graphs, offering simplicity and portability. Catapult, on the other hand, provides a more comprehensive suite of performance analysis tools with a broader scope. The code comparison highlights FlameGraph's focus on stack trace processing, while Catapult demonstrates its capability in handling various trace event types.
APM, Application Performance Monitoring System
Pros of SkyWalking
- More comprehensive application performance monitoring (APM) solution
- Supports multiple programming languages and frameworks
- Active development with frequent updates and releases
Cons of SkyWalking
- Steeper learning curve due to its complexity
- Requires more system resources for deployment and operation
- May be overkill for smaller projects or simpler monitoring needs
Code Comparison
SkyWalking (Java agent configuration):
<agent.application_code>MyApp</agent.application_code>
<collector.backend_service>localhost:11800</collector.backend_service>
<logging.level>INFO</logging.level>
Catapult (Python tracing example):
from catapult.tracing import trace
@trace
def my_function():
# Function code here
Summary
SkyWalking is a more robust APM solution with broader language support and frequent updates. However, it may be more complex and resource-intensive compared to Catapult. Catapult offers simpler tracing capabilities and may be more suitable for smaller projects or those primarily focused on performance analysis. The choice between the two depends on the specific monitoring needs and scale of the project.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Catapult
Catapult is the home for several performance tools that span from gathering, displaying and analyzing performance data. This includes:
These tools were created by Chromium developers for performance analysis, testing, and monitoring of Chrome, but they can also be used for analyzing and monitoring websites, and eventually Android apps.
Contributing
Please see our contributor's guide
Top Related Projects
The official GitHub mirror of the Chromium source
A microbenchmark support library
PerfView is a CPU and memory performance-analysis tool
Stack trace visualizer
APM, Application Performance Monitoring System
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot