You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flex.apache.org by "Benoit Wiart (JIRA)" <ji...@apache.org> on 2013/11/13 19:33:22 UTC

[jira] [Commented] (FLEX-33897) MediaQueryParser should not allocate memory for expressions already cached

    [ https://issues.apache.org/jira/browse/FLEX-33897?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13821647#comment-13821647 ] 

Benoit Wiart commented on FLEX-33897:
-------------------------------------

No after version as the memory allocations totally disappear (when it's a cache hit)

> MediaQueryParser should not allocate memory for expressions already cached
> --------------------------------------------------------------------------
>
>                 Key: FLEX-33897
>                 URL: https://issues.apache.org/jira/browse/FLEX-33897
>             Project: Apache Flex
>          Issue Type: Improvement
>          Components: Mobile: Performance, Styles
>    Affects Versions: Apache Flex 4.11.0
>         Environment: desktop mobile
>            Reporter: Benoit Wiart
>            Priority: Minor
>              Labels: memory, performance
>         Attachments: mediaquery-example-1.png
>
>
> When using @media from default sdk styles or custom styles
> the mxml compiler generates code like :
> if (styleManager.acceptMediaList("(application-dpi:160)"))
> {
>     this.focusThickness = 3;
>     this.fontSize = 24;
> }
> if (styleManager.acceptMediaList("(application-dpi:320)"))
> {
>     this.fontSize = 24;
> }
> if (styleManager.acceptMediaList("(application-dpi:480)"))
> {
>     this.focusThickness = 3;
>     this.fontSize = 24;
> }
> ...
> The acceptMediaList is often called, it delegates to MediaQueryParser which has a cache of known media expressions.
> But MediaQueryParser#parse allocates some memory even if the expression is in the cache. these allocations come from the string manipulation.
> this patch use the original expression as the key in the cache instead of the 'lowercased' expression.
> It will increase the cache size (by a small percentage) only if you have the same media expression in different case.



--
This message was sent by Atlassian JIRA
(v6.1#6144)