Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mathjax/mathjax-profiler
A JavaScript tool to profile MathJax rendering, in particular rendering speed and errors.
https://github.com/mathjax/mathjax-profiler
Last synced: about 2 months ago
JSON representation
A JavaScript tool to profile MathJax rendering, in particular rendering speed and errors.
- Host: GitHub
- URL: https://github.com/mathjax/mathjax-profiler
- Owner: mathjax
- License: apache-2.0
- Created: 2014-05-09T13:15:55.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-09-20T16:39:58.000Z (over 9 years ago)
- Last Synced: 2024-04-15T00:25:24.208Z (9 months ago)
- Language: JavaScript
- Size: 207 KB
- Stars: 2
- Watchers: 5
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MathJax-profiler
This repository contains the MathJax profiler and a sample
HTML file visually rendering the profiling data.* `MathJax-Profiler.js`: the profiler
* `test/Performance-Test.html`, `test/performance.js`: example for visualizing profiler data
See the comments in `MathJax-Profiler.js` for how to send
the data collected on the client back to your server.# Example using Google Analytics
Google Analytics can collect [custom user timings](https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingTiming). The profiler can easily be set up to provide the necessary data. Simply load it after GA and before MathJax.js and specify which data to include.
For a simple example, a `Data_Saver` function as below will collect 3 basic timings:
* loading of MathJax.js
* Overall timing -- loading up of components as well as typesetting. ("Startup")
* just typesetting ("Typeset")To add more timings, you simply pick more values from the `events` object.
```javascript
function Data_Saver() {
for (var b = MathJax.Extension.Profiler, c = b.events, d = 0, e = c.length; e > d; d++) {
var f = c[d].n, //name
g = c[d].s, //start time
h = c[d].e; //end time
if ("Startup" === f) {
var i = h - g;
_gaq.push(["_trackTiming", "MathJax", f, i, document.URL])
}
if ("Typeset" === f) {
var i = h - g;
_gaq.push(["_trackTiming", "MathJax", f, i, document.URL]), _gaq.push(["_trackTiming", "MathJax", "Total time", h, document.URL])
}
"MathJax.js" === f && _gaq.push(["_trackTiming", "MathJax", f, c[d].c, document.URL])
}
}