When working on Qlik Sense performance issues I frequently find I want to measure the performance of specific expressions. I might want to know how variations of an expression may perform against each other. In a slow chart with many measures I want calculation time individually for each measure to focus my efforts. Or perhaps I’m just satisfying a general curiosity or trying to settle a bet.
You can measure the performance of expression variations by modifying the chart and measuring the overall chart response time with something like Chrome Add Sense or QS Document Analyzer. That approach can get kind of clunky especially when you are focused on a subset of measures in the chart.
I prefer a more structured approach to testing expressions. The tool I reach for is CubeTester.
CubeTester is an open source Nodejs command line tool for testing the performance of Qlik HyperCubes (Dimensions and Measures). The test specification is written in a json file as either a HyperCubeDef or the “simplified” Dimension/Measure syntax.
Here’s a sample test written in simplified syntax that tests three variations of a cube (chart) containing one Dimension and three Measures.
I’ll run CubeTester specifying the file that holds this test:
node index.js test tests/columns.json
And receive this output:
There is no significant difference in performance between the variations. Importantly, I can also see that all three return identical total values as well.
CubeTester supports two commands:
- test : Run tests.
- extract: Extract app charts into a test file.
There are a number of options that can be specified on the command line or in the test definition. See the readme for more information on available options.
in addition to testing variations or trying out a theory, here are some other cases where I’ve used CubeTester.
- When working with a mashup where my HyperCube exists only in code, there is no chart to test.
- In a slow rendering chart I can test individual measures, combinations of measures and non-data expressions (like color expressions) to find the culprit.
Using CubeTester I can quickly try out ideas and document my progress as I work through an issue. I’ve made some interesting discoveries!
- Testing against a server uses certificates for authentication. (Pull request welcome if you want more auth options).
- Make sure you specify “wss” when using a server endpoint eg
- You’ll need to test with enough data to get calculation times of sufficient magnitude. Two results of 5 milliseconds vs 7 milliseconds are not precise enough to draw conclusions from.
- Calculation time is affected by the capacity of the target machine and what else is running. I recommend to repeat tests until you see a stable pattern. Use the –repeat option and take the lowest result from each repeat.
CubeTester is free to use. Have fun!