Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add Plotly.profile() API for performance profiling#7657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Rhoahndur wants to merge2 commits intoplotly:master
base:master
Choose a base branch
Loading
fromRhoahndur:feature/profile-api

Conversation

@Rhoahndur
Copy link

Overview

This PR adds a newPlotly.profile() API method that enables users to diagnose
rendering performance of their Plotly charts by collecting timing data for each
phase of the rendering pipeline.

Motivation

Users often ask "why is my chart slow?" but currently have no built-in way to
diagnose where time is being spent. This profiler provides visibility into the
rendering lifecycle, helping users understand whether bottlenecks are in data
processing (doCalcdata), DOM manipulation (drawFramework), or actual drawing
(drawData).

Future direction: This MVP focuses on timing collection. Down the line, this
could potentially be extended to:

  • Provide optimization suggestions based on profile data (e.g., "consider using
    scattergl for datasets > 10k points")
  • Recommend optimal data structures for different trace types
  • Help users choose appropriate partial bundles based on their usage

I wanted to get community feedback on the core API before expanding scope.

What this PR does

  • AddsPlotly.profile(gd, [enable]) to enable/disable profiling on a graph div
  • Collects timing for rendering phases: supplyDefaults, doCalcdata, drawFramework,
    drawData, etc.
  • Stores results ingd._profileData after each render
  • Emitsplotly_profiled event for reactive integrations
  • Zero overhead when profiling is disabled

Usage

// Enable profilingPlotly.profile(gd);// Render or update a chartPlotly.react(gd,[{y:[1,2,3]}]);// Inspect timing breakdownconsole.log(gd._profileData);// { total: 45.2, phases: { supplyDefaults: {...}, doCalcdata: {...}, ...}}// Listen for profiling eventsgd.on('plotly_profiled',data=>console.log('Render took',data.total,'ms'));// Disable profilingPlotly.profile(gd,false);##Fileschangedsrc/lib/profiler.js(NEW)-Coretimingutilitysrc/plot_api/profile.js(NEW)-PublicAPImethodsrc/lib/index.js-Exportprofilermodulesrc/plot_api/index.js-Exportprofilemethodsrc/plot_api/plot_api.js-Addtiminghookstorenderingpipelinetest/jasmine/tests/profile_test.js(NEW)-Unittests##ChecklistWorkingondevbranch,notmasterMergedwithlatestupstream/masterDidNOTmodifydist/foldernpmrunlintpassesTestspass(npmruntest-jasmine--profile)Note:Thisismyfirstcontributiontoplotly.js(workingontwoPRsforthisproject).I've done my best to follow the contribution guidelines and existingcodepatterns,butI'm very open to feedback on the API design, implementationapproach,oranythingelse.Thankyoufortakingthetimetoreview!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@Rhoahndur

[8]ページ先頭

©2009-2025 Movatter.jp