Github user nielsbasjes commented on the issue:

    https://github.com/apache/wicket/pull/275
  
    @klopfdreh 
    A few points about the slow startup.
    When you explicitly specify which fields you really need the system will 
completely 'not load' the rules that have no impact. Especially if you do not 
need the DeviceBrand/DeviceName the impact will be quite large. You can simply 
pass something like this .withField("AgentName") .withField("DeviceClass") 
.withField("AgentVersion") and it will have a big impact on both startup times 
and run times for a not yet cached parse.
    
    I had a look at your project and with this patch the startup time drops to 
less than 1.5 seconds.
    
    ```
    diff --git pom.xml pom.xml
    index 00cc8f8..7910bd9 100644
    --- pom.xml
    +++ pom.xml
    @@ -146,7 +146,7 @@
                            <dependency>
                                <groupId>nl.basjes.parse.useragent</groupId>
                                <artifactId>yauaa</artifactId>
    -                           <version>4.2</version>
    +                           <version>4.5</version>
                            </dependency>
                            <dependency>
                                    <groupId>com.google.code.findbugs</groupId>
    diff --git 
wicket-core/src/main/java/org/apache/wicket/protocol/http/request/WebClientInfo.java
 
wicket-core/src/main/java/org/apache/wicket/protocol/http/request/WebClientInfo.java
    index 5a02a3d..1e488e9 100644
    --- 
wicket-core/src/main/java/org/apache/wicket/protocol/http/request/WebClientInfo.java
    +++ 
wicket-core/src/main/java/org/apache/wicket/protocol/http/request/WebClientInfo.java
    @@ -151,6 +151,9 @@ public class WebClientInfo extends ClientInfo
                    {
                            userAgentAnalyzer = UserAgentAnalyzer.newBuilder()
                                    .hideMatcherLoadStats()
    +                               .dropTests()
    +                               .withField("AgentName")
    +                               .withField("AgentVersion")
                                    .withCache(25000)
                                    .build();
                            Application.get().setMetaData(UAA_META_DATA_KEY, 
userAgentAnalyzer);
    @@ -217,7 +220,7 @@ public class WebClientInfo extends ClientInfo
             */
            protected void 
setBrowserVersion(nl.basjes.parse.useragent.UserAgent parsedUserAgent)
            {
    -               String value = 
parsedUserAgent.get("AgentVersion").getValue();
    +               String value = parsedUserAgent.getValue("AgentVersion");
                    if (!"Hacker".equals(value))
                    {
                            properties.setBrowserVersion(value);
    ```



---

Reply via email to