Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: Tim MeagherHey,
When you increase the number of columns, are you talking about increasing both the number of input & output columns?
Also are you increasing the processing performed prior to writing the records or are the variables for these fields already in existence in the 3 column output, where the only difference is that you actually write them to the output in the 4 column case?
Essentially, you have to look at all of the processing that is being performed to understand why this is occurring.
Every time you access a record, and try and read fields off an input record, this record and the fields themselves need to be deserialized into variables accessible within python.
Each operation you perform will also obviously add to the processing time.
In addition, the size of the data you are reading and writing - particularly when processing large numbers of records - will impact performance. This includes naturally the number of fields within the metadata, but also the width of each field. If your first 3 fields were simple integer or boolean fields, and the fourth field is a string which can have a lot of data, then performance will also be impacted.
If in the addition of adding fields, you are introducing additional floating point operations (as in the case of IFRS_GBV * sigma in your example), then this too will have an impact.
If there are no additional calculations introduced, and you are simply adding additional fields whose values have already been calculated within the data, then the jump from 15 minutes to 30 minutes does seem quite large - unless the fourth column contains large string data.
Perhaps posting your python node (or if you don't want to post this publicly, then PMing this) would allow someone to look at what exactly is going on here.
I did a little bit of performance anaylsis of the python node using 5 million input records, where each record contained 26 very simple single-character String fields ("a","b","c",...,"z").
For these tests, each node was to simply to read it's input records, and write them to the output pin. In addition, the nodes output some statistics relating to processing time.
This was done for an unoptimised python node (using String based indexing), an optimised python node (using integer based indexing), a simple filter node and an optimised java node.
The results are in the attached chart - with the elapsed time in seconds.
From this, you will see that the python node performance is significantly worse than that of a filter node (indeed it will be significantly worse than a lot of the brainscript based nodes). The obvious reason being that brainscript allows only a restricted set of operations that can be performed within well defined and restricted nodes, thus allowing for optimized binaries to be used for each node.
However, you might also notice that the Java node (which is available as of LAE 4.5 and onwards) has much better performance than that of the python node, and approaches that of the filter node.
For this reason from 4.5. onwards, when attempting to perform complex calculations/logic which you are unable to do within the standard LAE nodes, the Java node is probably the best option if you want to improve performance compared with a Python node.
While this may not help you at the moment, it is certainly something to consider in the future.
Attachments:
NodePerformanceComparison.jpg