Thanks to visit codestin.com
Credit goes to github.com

Skip to content

优化建议:高频函数中内存优化 #145

@joechan-cq

Description

@joechan-cq
  • SAViewUtils.getViewContent 中,将 SAViewUtils.traverseView 的返回 String,调用 substring,去除最后的“-”字符,产生不少临时字符串的多余内存分配

优化建议:traverseView 将 StringBuilder 作为返回值返回,然后用 StringBuilder.deleteCharAt() 方法来删除最后的字符

  • SnapCache.getViewType 中,mLruViewInfo 使用 String 作为缓存 Key,存在大量的 int 转 String 操作,导致大量临时字符串内存分配

优化建议:mLruViewInfo 改成 Integer 作为 Key,并开发 API,允许外部配置缓存大小

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions