May 02, 2013; 06:50
Jolle Carlestam
[Tip] Avoid using lasso 8 style date formatting rules when in Lasso 9
The Lasso 9 date type allows for the same formatting rules that Lasso 8 offers. That is, formats like
date -> format(`%d %b %Y`). Anything that contains a %.
But, it turns out that the Lasso 9 date type first translates that to the proper ICU equivalent before continuing processing the date object. Thus adding processing cycles for each call. In the above example it's translated to
date -> format(`dd MMM yyyy`).
If you have a single date on a page the speed difference is indifferent. But if you have a number of date calls, like on a list of records with date fields in them, the added processing is measurable.
debug -> timer(100, 'Lasso 8') => {
date -> format(`%d %b %Y`)
}
debug -> timer(100, 'Lasso 9') => {
date -> format(`dd MMM yyyy`)
}
->
Lasso 8 x100
micros:38907.000000
micros_average:389.070000
Lasso 9 x100
micros:15884.000000
micros_average:158.840000
Less than half the time for the pure Lasso 9 format. If you want help finding out what format rules to use you can take a look at the Lasso Reference:
http://www.lassosoft.com/lassoDocs/languageReference/obj/date/format
Or peek at the translation map used by the Lasso 9 date type:
'%%'='%', // escape
'%_'='%', // strip out this option
// dates/times
'%D'='MM/dd/yyyy',
'%Q'='yyyy-MM-dd',
'%q'='yyyyMMddHHmmss',
'%r'='hh:mm:ss a',
'%T'='HH:mm:ss',
// non-padded
'%-D'='M/d/yyyy',
'%-Q'='yyyy-M-d',
'%-r'='h:m:s a',
'%-T'='H:m:s',
// parts
'%d'='dd',
'%h'='hh',
'%H'='HH',
'%M'='mm',
'%m'='MM',
'%p'='a',
'%S'='ss',
'%w'='e',
'%W'='ww',
'%y'='yy',
'%Y'='yyyy',
'%z'='Z',
// non-padded
'%-d'='d',
'%-h'='h',
'%-H'='H',
'%-M'='m',
'%-m'='M',
'%-S'='s',
'%-w'='E',
'%-W'='w',
'%-y'='y',
// names
'%a'='EEE',
'%A'='EEEE',
'%b'='MMM',
'%B'='MMMM'
HDB
Jolle
#############################################################
Attend the Lasso Developer Conference 2013!
Sept 12-14, 2013 in Niagara Falls, Canada
http://www.lassosoft.com/LDC-niagara-falls-2013
#############################################################
This message is sent to you because you are subscribed to
the mailing list Lasso
Lasso@lists.lassosoft.com
To unsubscribe, E-mail to: <Lasso-unsubscribe@lists.lassosoft.com>
Send administrative queries to <Lasso-request@lists.lassosoft.com>
May 02, 2013; 11:45
Ke Carlton
Re: [Tip] Avoid using lasso 8 style date formatting rules when in Lasso 9
May 02, 2013; 13:08
Marc Vos
Re: [Tip] Avoid using lasso 8 style date formatting rules when in Lasso 9
May 02, 2013; 15:56
Jolle Carlestam
Re: [Tip] Avoid using lasso 8 style date formatting rules when in Lasso 9
May 03, 2013; 11:15
Ke Carlton
Re: [Tip] Avoid using lasso 8 style date formatting rules when in Lasso 9