New article

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

New article

Jonathan Guthrie-5
Hi all,

Last night I wrote up an article, in response to an issue someone asked me about a few days ago:

Dealing with web_request->param in Lasso 9
Lasso 9's new "web_request->param" behaves quite differently to action_param found in previous versions of Lasso.
It's lower-level, and a little more verbose, but significantly faster - which makes it an obvious tool to master.

http://jono.guthrie.net.nz/Dealing-with-webrequest-param-in-Lasso-9

As always, constructive comments welcome :)

Thanks
Jono


#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: New article

Jolle Carlestam-3
Well written!

HDB
Jolle

11 okt 2013 kl. 18:51 skrev Jonathan Guthrie <[hidden email]>:

> Hi all,
>
> Last night I wrote up an article, in response to an issue someone asked me about a few days ago:
>
> Dealing with web_request->param in Lasso 9
> Lasso 9's new "web_request->param" behaves quite differently to action_param found in previous versions of Lasso.
> It's lower-level, and a little more verbose, but significantly faster - which makes it an obvious tool to master.
>
> http://jono.guthrie.net.nz/Dealing-with-webrequest-param-in-Lasso-9
>
> As always, constructive comments welcome :)
>
> Thanks
> Jono

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: New article

Jolle Carlestam-3
In reply to this post by Jonathan Guthrie-5
11 okt 2013 kl. 18:51 skrev Jonathan Guthrie <[hidden email]>:

> Dealing with web_request->param in Lasso 9
> Lasso 9's new "web_request->param" behaves quite differently to action_param found in previous versions of Lasso.
> It's lower-level, and a little more verbose, but significantly faster - which makes it an obvious tool to master.

Here's a comment I made to the article:
Note that if you have more than a few params sent, for example if the client is submitting a large form, there are even faster ways of getting to the params.

What slows web_request -> param('XYZ') down is that each time it is called it is itself calling the method web_request -> params and looking thru it for the requested param. But web_request -> params is not a static object. It is built by creating a tie of the query params (the params sent as part of the URL) and the post params (stuff sent as part of a form). This takes time, the larger the form, the more time it takes. Thus if you have more than a few params it is better to call web_request -> params only once and grab all params out of it in one iteration. Either by creating locals for each param or by putting all params into a map. The latter is significantly fastest. Do this at the start of your process and you can replace all calls to either action_param or web_request -> param with a call to your map:
#MapWithAllParams -> find('X')

------
End comment

And here's example code to do that:
        local(MapWithAllParams = map)
        with p in web_request -> params
        do {
                #MapWithAllParams -> insert(#p->first -> asstring = #p->second -> asstring)
        }

#MapWithAllParams -> find('X')

-> Marks the spot

HDB
Jolle

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: New article

Ke Carlton-3
++ I do something similar and is much faster.

I also have custom methods: getparam and postparam that leverage the
object. I'll look at packaging them up and posting them.

Ke

On Friday, October 11, 2013, Jolle Carlestam wrote:

> 11 okt 2013 kl. 18:51 skrev Jonathan Guthrie <[hidden email]<javascript:;>
> >:
>
> > Dealing with web_request->param in Lasso 9
> > Lasso 9's new "web_request->param" behaves quite differently to
> action_param found in previous versions of Lasso.
> > It's lower-level, and a little more verbose, but significantly faster -
> which makes it an obvious tool to master.
>
> Here's a comment I made to the article:
> Note that if you have more than a few params sent, for example if the
> client is submitting a large form, there are even faster ways of getting to
> the params.
>
> What slows web_request -> param('XYZ') down is that each time it is called
> it is itself calling the method web_request -> params and looking thru it
> for the requested param. But web_request -> params is not a static object.
> It is built by creating a tie of the query params (the params sent as part
> of the URL) and the post params (stuff sent as part of a form). This takes
> time, the larger the form, the more time it takes. Thus if you have more
> than a few params it is better to call web_request -> params only once and
> grab all params out of it in one iteration. Either by creating locals for
> each param or by putting all params into a map. The latter is significantly
> fastest. Do this at the start of your process and you can replace all calls
> to either action_param or web_request -> param with a call to your map:
> #MapWithAllParams -> find('X')
>
> ------
> End comment
>
> And here's example code to do that:
>         local(MapWithAllParams = map)
>         with p in web_request -> params
>         do {
>                 #MapWithAllParams -> insert(#p->first -> asstring =
> #p->second -> asstring)
>         }
>
> #MapWithAllParams -> find('X')
>
> -> Marks the spot
>
> HDB
> Jolle
>
> #############################################################
> This message is sent to you because you are subscribed to
>   the mailing list Lasso
> [hidden email] <javascript:;>
> To unsubscribe, E-mail to: <[hidden email]<javascript:;>
> >
> Send administrative queries to  <[hidden email]<javascript:;>
> >
>

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: New article

Steve Upton
In reply to this post by Jonathan Guthrie-5

On Oct 11, 2013, at 9:51 AM, Jonathan Guthrie <[hidden email]> wrote:

> Hi all,
>
> Last night I wrote up an article, in response to an issue someone asked me about a few days ago:
>
> Dealing with web_request->param in Lasso 9
> Lasso 9's new "web_request->param" behaves quite differently to action_param found in previous versions of Lasso.
> It's lower-level, and a little more verbose, but significantly faster - which makes it an obvious tool to master.
>
> http://jono.guthrie.net.nz/Dealing-with-webrequest-param-in-Lasso-9
>

While this is useful and I appreciate your effort in writing up an article, the skeptic in me wonders if this is more an indication that action_param should be re-written?

regards,

Steve



#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: New article

Jonathan Guthrie-3
Be the skeptic all you like, it can he healthy when coupled with a positive attitude :)

However, one of the reasons action_param is slower is because it's an abstraction layer. Abstraction itself means it introduces inefficiency. That's not a bad thing if you're looking for ease of use. Note that I make the point that it's less verbose using action_param. It also has to account for scope - i.e. being aware of the inline scope it's operating in.

So when you combine those two, you can see that there's more to it than "it's slower therefore it should be rewritten" :)

Clear as mud?

On 2013-10-11, at 7:14 PM, Steve Upton <[hidden email]> wrote:

>
> On Oct 11, 2013, at 9:51 AM, Jonathan Guthrie <[hidden email]> wrote:
>
>> Hi all,
>>
>> Last night I wrote up an article, in response to an issue someone asked me about a few days ago:
>>
>> Dealing with web_request->param in Lasso 9
>> Lasso 9's new "web_request->param" behaves quite differently to action_param found in previous versions of Lasso.
>> It's lower-level, and a little more verbose, but significantly faster - which makes it an obvious tool to master.
>>
>> http://jono.guthrie.net.nz/Dealing-with-webrequest-param-in-Lasso-9
>>
>
> While this is useful and I appreciate your effort in writing up an article, the skeptic in me wonders if this is more an indication that action_param should be re-written?
>
> regards,
>
> Steve
>
>

Jono

----------------------------
Jonathan Guthrie
[hidden email]
@iamjono
LassoSoft Inc.
AIM Chatroom: lassochat
IRC/freenode #lasso


#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: New article

Jolle Carlestam-3
In reply to this post by Steve Upton
12 okt 2013 kl. 01:14 skrev Steve Upton <[hidden email]>:

>
> On Oct 11, 2013, at 9:51 AM, Jonathan Guthrie <[hidden email]> wrote:
>
>> Hi all,
>>
>> Last night I wrote up an article, in response to an issue someone asked me about a few days ago:
>>
>> Dealing with web_request->param in Lasso 9
>> Lasso 9's new "web_request->param" behaves quite differently to action_param found in previous versions of Lasso.
>> It's lower-level, and a little more verbose, but significantly faster - which makes it an obvious tool to master.
>>
>> http://jono.guthrie.net.nz/Dealing-with-webrequest-param-in-Lasso-9
>>
>
> While this is useful and I appreciate your effort in writing up an article, the skeptic in me wonders if this is more an indication that action_param should be re-written?
>
> regards,
>
> Steve

The skeptic in me made me stop using action_param long before I made the jump to Lasso 9. I never liked the ambiguity built into it due to its context sensitivity. Instead I used one of the custom made tags (in my case lp_client_param) in Lasso 8.X. In Lasso 9 you have the choice of continuing using action_param, use web_request -> param or go for a custom wrapper. As always there's a balance you need to settle on between convenience for the coder or efficiency for the code execution. Using a wrapper for a low level call will always come at a prize. For me, the prize of using action_param is too costly.

HDB
Jolle

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>