Jun 17, 2014; 12:26
Jolle Carlestam
Different ways to find out what browser the visitor is using
Here=92s a tidbit about finding out what browser the client is using.
Relevant for all ye modern Lasso 9 users.
Lasso provides several ways of finding out the browser used.
The simplest is the readymade method:
client_browser
But, there=92s also the Lasso 9 way of checking the web_request:
web_request -> httpuseragent
The third way I know of, and the route if you want to write really complicated code (and chase speed) is to mine the raw web_request:
web_request -> raw -> find('HTTP_USER_AGENT=92)
The third way is the fastest. Without access to the code definitions I would venture it=92s because both of the first methods are wrappers for the third one. Get rid of the wrapper and you gain speed.
Now, all three methods are fast. We=92re talking about a difference between ruffly 10 micros and 7. So I don=92t think changing from the easily written and readable client_browser to the complicated web_request -> raw -> find('HTTP_USER_AGENT=92) will save your day if you=92re speed optimizing your slow site. You can safely assume that whatever method you prefer the outcome will be the same.
Speed test was performed using the following code and Ke Carltons debug (http://l-debug.org/)
debug -> timer(10000, 'client_browser') => {
client_browser -> asstring
}
debug -> timer(10000, 'web_request -> httpuseragent') => {
web_request -> httpuseragent -> asstring
}
debug -> timer(10000, 'web_request -> raw') => {
web_request -> raw -> find('HTTP_USER_AGENT') -> asstring
}
HDB
Jolle
#############################################################
This message is sent to you because you are subscribed to
the mailing list Lasso Lasso@lists.lassosoft.com
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <Lasso-unsubscribe@lists.lassosoft.com>
Send administrative queries to <Lasso-request@lists.lassosoft.com>