使用自定义渲染器慢速 Spark 列表初始化
我有一个带有 customItemRenderer 的 Spark 列表,仅用 50 个项目就需要 3 秒的时间来初始化。
我使用的是Flex 4.5,我的ItemRenderer已经非常优化,使用尽可能少的嵌套,fxg等。
有人有类似的问题吗? 我几乎尝试了书吧中的所有内容,直到回到 mx。
I have a Spark list with a customItemRenderer that is taking a good 3 seconds to initialize with just 50 items.
I'm using Flex 4.5, my ItemRenderer is already very optimized, using as little nesting as possible, fxg and so on.
Is anyone having similar issues?
I've tried almost everything in the book bar going back to mx.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
因此,问题是由于 Spark 处理样式的方式造成的,该问题详细信息如下: http:// /bugs.adobe.com/jira/browse/SDK-29880 并可以通过猴子修补进行排序:http://taytay.com/?p=169
删除全局 CSS 选择器“*”也有帮助。
So the issue was due to the way that spark handles styling the issue is detailed here: http://bugs.adobe.com/jira/browse/SDK-29880 and can be sorted by monkey patching with: http://taytay.com/?p=169
Also removing global css selectors "*" helps.
尽可能避免HGroup和VGroup,改用绝对布局。我也遇到过同样的问题,这已经为我解决了大部分问题。
1 hgroup + 1vgroup 每三次 = 每个项目 6 个自动布局。所以总共有 150 个对象,太多了。
Avoid HGroup and VGroup as much as possible, use absolute layout instead. I've had this same problem at that's fixed most of it for me.
1 hgroup + 1vgroup each three times = 6 automatic layouts PER ITEM. So in total you have 150 objects, WAY too much.
应用 Pedro 提到的猴子补丁后,仅获得了适度的性能提升(我想我们的样式较少,或者性能已修复)在最近的补丁中),我继续分析 List 实例的初始化。
我发现的一件事是,Flex 在
UIComponent
的initializeAccessibility
函数中花费了相当多的时间,即使我们的应用程序不以任何方式支持可访问性(无论应用程序是否应该这样做是一个完全不同的问题)。只需将
-accessible=false
添加到编译器参数中,就可以将初始化特别繁重的列表所花费的时间减少大约三分之一!不仅如此,当打开窗口、第一次显示控件等时,整个应用程序总体感觉更加快捷。如果您不需要辅助功能支持,您可能需要检查一下 - 如果您需要,我会确保可以采取一些措施来修复initializeAccessibility
的糟糕性能 - 只需在组件实现中覆盖它,或者通过更多的猴子修补:-)After applying the monkey patch mentioned by Pedro with only modest performance gains (I suppose we had fewer styles, or the performance was fixed in a more recent patch), I continued profiling the initialization of our List instances.
One thing I found is that Flex spends quite a lot of time in
UIComponent
'sinitializeAccessibility
function, even though our application does not support accessibility in any way (whether applications ought to do that is an entirely different issue).Merely adding
-accessible=false
to the compiler arguments cut time spent initializing a particularly heavy list by about a third! Not only that, the whole application in general feels snappier when windows are opened, controls are shown for the first time, etc. If you have no need of accessibility support, you might want to check this out - if you do, I'm sure something can be done to fix the abysmal performance ofinitializeAccessibility
- simply through overriding it in your component implementations, or through even more monkey patching :-)您的项目渲染器是否有复选框?最近,一些人遇到了 Spark 的一系列性能问题。
http://blogs.adobe.com/aharui/2011/04/migatory-foul-performance-problems-migration-from-flex-3-x-to-flex-4-x.html< /a>
Adobe 已收到通知,并且显然正在处理此问题:
https://bugs.adobe.com/jira/browse/SDK-29451
Are your item renderers checkboxes by any chance? A few folks have recently run into a bunch of performance issues with Spark in general.
http://blogs.adobe.com/aharui/2011/04/migratory-foul-performance-problems-migrating-from-flex-3-x-to-flex-4-x.html
Adobe has been notified, and apparently are working on it:
https://bugs.adobe.com/jira/browse/SDK-29451