View as Markdown

Summary

  • AdapTable provides 3 very useful resources to help Support Teams profile AdapTable:
    • It will provide performance metrics (by leveraging logging)
    • It offers performance profiling (by leveraging the Chrome DevTools profiler)
    • The AdapTable DevTools browser extension has a dedicated Performance section

AdapTable provides some very useful resources to help Support Teams profile AdapTable.

They time the same AdapTable operations, and show them in different places:

WhatTurned on byWhere you see it
Performance Metrics (perf log messages)localStorage.debug = 'Adaptable:*:perf'The browser console
Chrome DevTools Profiler tracksA recording in the AdapTable DevTools Performance section, localStorage.adaptableProfileTracks = 'true', or the perf debug channelThe Chrome Performance panel, next to everything else the page does
The AdapTable DevTools Performance sectionRecord in that sectionTimings, Hot Paths (the cost of every cell callback, by AdapTable object), long frames and memory (the JS heap and the size of AdapTable's structures)

Hint

The quickest way to find what is slow is the Performance section of the AdapTable DevTools browser extension: it needs no setup, and it links the time spent to the AdapTable objects that caused it (see AdapTable DevTools)

Performance Metrics

AdapTable logs performance metrics for certain operations.

Find Out More

Consult the Guide to Logging AdapTable Activity for full details on how AdapTable enables comprehensive logging

These are logged as perf messages.

Note

Make sure to set the Browser's console level to Verbose to see these messages (read instructions for using Chrome)

// log all performance metrics for all AdapTable instances
localStorage.debug = 'Adaptable:*:perf'
// log all performance metrics for a specific AdapTable instance
localStorage.debug = 'Adaptable:<adaptableId>:perf'

The perf messages will look like this:

Adaptable:Trades:perf [BEGIN] - initAgGrid() +1ms
[...]
Adaptable:Trades:perf [END]   - initAgGrid() :: [delta +122ms] +1ms

The delta value ([+122ms]) is the time taken for the operation (initAgGrid()) to complete.

The last diff value (+1ms) is displayed for all messages and is the time spent between the previous message and the current one.

Performance Profiling

Another way to profile performance in AdapTable is to use the Chrome DevTools profiler.

AdapTable will show up as a custom track in your recorded profile.

This is a very powerful tool which will give you a better sense of the timing for various operations.

It includes stacktraces and allows you to see the correlation between user actions, other browser events and the AdapTable instance.

Chrome DevTools Profiler

To start a profiling operation, open your DevTools, go to the Performance tab and start recording.

AdapTable writes its tracks in 3 cases:

  • While a recording runs in the Performance section of AdapTable DevTools: click Record there (or Record and reload to include the start-up), then record in the Chrome Performance panel at the same time; startPerfRecording() of the DevTools In-page API does the same
  • All the time, when the Adaptable:<adaptableId>:perf debug channel is enabled (see below)
  • All the time, without the extension, when the adaptableProfileTracks key is "true" in your localStorage:
localStorage.adaptableProfileTracks = 'true'

Note

  • AdapTable reads the key again within a second, so no reload is needed; reload to include the start-up
  • window.__ADAPTABLE_DEVTOOLS__.enableProfiling() sets it too (see DevTools In-page API)
  • Remove the key when you are done: it writes a track entry for every operation, all the time

Another option would be to enable the debug channels for performance metrics, as already described above

localStorage.debug = 'Adaptable:*:perf'

This will show you all AdapTable instances - each under the AdapTable (<adaptableId>) track group.

If you have many AdapTable instances, but only want to profile one of them, you can be more specific and enable profiling only for that single instance, enabling the Adaptable:<ADAPTABLE_ID>:perf channel.

For instance you have a 'BigData' AdapTable instance, then you will do:

localStorage.debug = 'Adaptable:BigData:perf'

Or you can simply enable all debug channels:

localStorage.debug = '*'

In this picture, you can see a recorded profile and how AdapTable displays its custom tracks.

AdapTable shows up in Chrome DevTools Performance Profiler tracks

In your recorded profiling traces, you can click various segments to get more info on the specific operation.

In the screenshot above, we selected the 'Apply table layout' operation to get details on it.

Beyond timing (this one took 370ms), we have info on the Layout's Name, Columns, Row Grouping and other useful Layout properties.

Available Tracks and Labels

Each profiled AdapTable instance will show up as a group, under the name AdapTable (<adaptableId>).

Inside the group for each AdapTable instance, the following tracks are available:

TrackLabelsShows
InitialisationInit, Loading store, Init store, AG Grid initThe start-up phases (Init spans all of them)
Layout ManagerSetting layout, Apply table layout, Apply pivot layoutLayout changes applied to the underlying AG Grid instance
RuntimeUpdate column model & refresh grid, Derive column state from AG Grid, Setup columns, Redraw body, Refresh cells, Refresh header, Setting layoutColumn model refreshes (e.g. after a State change) and their steps
Reduxthe action's name, e.g. LAYOUT_SELECTEvery Redux action AdapTable dispatches, how long it took, and which State sections it changed

Each of those tracks can have multiple labels/segments show up.

AdapTable Chrome DevTools Profiler multiple segments