TACTIC Open Source
Speeding up naming Convertions - Printable Version

+- TACTIC Open Source (http://forum.southpawtech.com)
+-- Forum: TACTIC Open Source (http://forum.southpawtech.com/forumdisplay.php?fid=3)
+--- Forum: TACTIC Discussion (http://forum.southpawtech.com/forumdisplay.php?fid=4)
+--- Thread: Speeding up naming Convertions (/showthread.php?tid=34)

Pages: 1 2


RE: Speeding up naming Convertions - listy - 02-21-2020

I already started to add simple logic like if or else, or case to the naming expressions, to avoid TEL. Will be experimenting with this soon


RE: Speeding up naming Convertions - listy - 02-23-2020

(02-21-2020, 03:28 PM)remkonoteboom Wrote: The function that handles this is "naming_to_dir()" in the file "src/pyasm/biz/naming.py".  If you look at the function, it will check to see if the value in the parenthesis either starts with a $ or @ and assumes an expression.  It will then go through the overhead of parsing the expression which has some overhead.  If not, it goes through a bunch of "if" statements to evaluate things like "sobject.code" directly (which is much faster).
I found the solution how to avoid editing tactic sources, and using TEL.
There is script_path in file_naming.py!
This is really handy and portable, also almost 3x faster than my TEL variant.
Example code:
Code:
sobject = input['sobject'].get_value
snapshot = input['snapshot'].get_value
file_object = input['file_object'].get_value
parent = input['sobject'].get_parent()


version = int(snapshot('version'))
if version in [-1, 0]:
    version = None

if input.get('ext'):
    if version:
        return u'ITSFILE_{0:03}'.format(version)
    else:
        return u'ITSFILE_versionless'
else:
    if file_object('type') == 'web':
        return u'ITSDIR/__preview/web'
    elif file_object('type') == 'icon':
        return u'ITSDIR/__preview/icon'
    else:
        return u'ITSDIR'
   


It's sad i didn't found it earlier  Sad


RE: Speeding up naming Convertions - remkonoteboom - 02-27-2020

I am not surprised. TEL's primary design was not to be fast, but to be very convenient. It doesn't handle complex logic and is not the best if you need to evaluate it thousands of times. At some point, it will always be faster to use targeted python logic.