Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: Tim MeagherHi,
Sorry for the delay in responding.
I did some tests with the Agg & Agg Ex nodes operating on 20 million records and didn't see an performance different when switching off the "Verify Inputs Sorted" parameter.
You can set this to false, however that simply means that the node will not error if the data is not in the order specified in the GroupBy parameter.
Generally you want your data to be sorted in this order, so I don't think there is any real benefit here for switching this parameter off unless you have specific needs for out of order data...
Off the top of my head, I can't think of what these might be at the moment.
In any case, there are nodes which have parameters which would change the performance characteristics.
For instance, on the X-Ref, Join Inner, Join Left, etc nodes, if you have sorted your data prior to the join, you wouldn't want to specify that the data needs to be sorted within the join.
However, each node documents the parameters it defines, and explains what the parameters do, so you really need to look at it on a node by node basis, and when constructing your graph ensure that you are using the nodes in the manner that best suits what you need both from a functionality and performance perspective.
In general, the biggest performance improvements that can be made through sensible graph design.
Some reasonably common cases of things that can impact performance are:
- re-sorting data that has already been sorted on the same keys
- performing inefficient joins that would result in a cartesian product of the input data sets (in cases where this isn't required)
- maintaining all fields/records through the entire graph when you only care about a subset of the fields
- inefficient BRAINscript, Java, or Python code in different nodes
- unnecessary use of clocks, or dependencies in data streams that lead to limit the parallelization of the graph.
In some cases, there is a trade-off between optimizing your graph and writing a graph that is maintainable & easy to understand.
For instance, rather than having 10 filter nodes performing simple operations, you may be able to write a single filter node to do the same thing.
However, if the BRAINscript code within the filter node becomes so complex that it is no longer easy to understand the purpose of the node with a quick glance, then often this is the sort of optimization that will lead to more problems later. This is particularly true if the person who originally wrote the graph hands it over to someone else to maintain/work on.
It would also remove the ability to see intermediate results and reduces the traceability of the graph.
However, if you had a case with 10 filter nodes, where each node renamed a single field, then putting this all into the one filter node which renames all the fields would not impact readability, but would improve performance.
There are also other things to consider, with regard to the execution time of the nodes.
For instance, a sort will normally take longer than a filter node (it's a more complex operation).
Therefore, discarding various records prior to a sort node would make more sense than doing this directly after the sort.
Tim.