原文: http://blog.barrkel.com/2011/10/delphi-xe2-compiler-performance.html

Delphi XE2 compiler performance

Delphi XE2 introduced namespaces across the runtime library. This stressed unit name lookup inside the compiler, and led to some severe performance regressions in certain cases. So during the runup to the XE2 release, I fired up a profiler and started investigating. It turns out there were numerous situations where lookups were being performed repeatedly with the same arguments, and logically the results should have been consistent across these repeated calls. A relatively cheap and easy fix seemed to be memoization. So I added a caching infrastructure to the compiler and used the profiler to guide me where to inject it.

For the most part - particularly for full builds - the cache works really well. But I've had some reports of bugs that I suspected were caused by the cache hanging on to function results slightly too long, and upon investigation, this turned out to be true. The problem with caches is usually in invalidation; if you don't invalidate the cache soon enough and in all required situations, you end up serving stale results. So there are a few bugs lurking in the Delphi compiler here, which I'm seeking out and squashing.

Some good news, however; I had anticipated that this might be the case, so I added a super secret switch that enables diagnosing a probable cache failure: caches can be selectively disabled, and if a problem goes away with the cache disabled, it's probably because of stale results.

Caches can be disabled by setting an environment variable:

DCC_CACHE_DISABLE='SearchUnitNameInNS,FileSystem,UnitFindByAlias,GetUnitOf'

The above environment variable setting disables all the compiler's caches. By including fewer than the four separate cache names, the problem can iteratively be narrowed down to a specific cache.

I've just been fixing one bug caused by the cache that brought home how needed it is. The project is large; almost 2 million lines. An initial build with the cache enabled takes about a minute on my machine; the bug exhibits itself in later incremental compiles when modifying the source code and pressing F9, producing spurious errors. However, once I disabled the cache (or rather, I recompiled the compiler with cache sanity checking enabled, which still filled out the cache, but also invoked the underlying logic, and simply compared the results to verify the cache), the build time took nearly 3 hours!

Note: invalidation is most likely to be a problem on incremental compiles, rather than full rebuilds, especially from within the IDE. The reason is that the compiler may have lots of stale data for one half of an incremental compile that it later decides is out of date (e.g. a dependency changed); this can leave a bunch of stale entries in the cache for all the memoized function calls that occurred in the first half of the compile. The cache is strictly per-compile; it keeps no data across multiple compilations, even partial compilations.

转载于:https://www.cnblogs.com/MaxWoods/p/3639969.html

Delphi XE2 compiler performance相关推荐

  1. Delphi XE2有什么新功能

    具体内容见PDF Delphi XE2有什么新功能Delphi XE2提供(offers)了令人兴奋(exciting)的新功能,让您能够建立高度可视化的,在Windows,Mac和iOS上的业务应用 ...

  2. Delphi XE2 发布了,期待了很久的东西,开始学习中。

    这个博客将记录我学习DELPHI XE2及开发相关应用程序的点点滴滴,因此该博客内容全部原创,我也不会转载和抄录别人的代码.为了让大家和我一同进步,所有示例都带源代码,你可以随时下载后进行调试运行. ...

  3. Delphi XE2 之 FireMonkey 入门(35) - 控件基础: TFmxObject: 其它

    Delphi XE2 之 FireMonkey 入门(35) - 控件基础: TFmxObject: 其它 TFmxObject 增加了 TagObject.TagFloat.TagString, 算 ...

  4. Delphi XE2 新控件 布局Panel TGridPanel TFlowPanel

    Delphi XE2 新控件 Firemonkey 布局Panel Windows平台VCl TGridPanel TFlowPanel FMX 跨平台 TLayout TGridLayout TFl ...

  5. 关于Delphi XE2的FMX的一点点研究之消息篇

    Delphi XE2出来了一阵子了,里面比较抢眼的东西,除了VCLStyle这个换肤的东西之外,另外最让人眼亮的应该是FMX这个东西了.万一的博客上都连载了一票的关于FMX的使用心得了.我还是没咋去关 ...

  6. Delphi7升级到Delphi 2010、Delphi XE、Delphi XE2总结 .

    Delphi7升级到Delphi 2010.Delphi XE.Delphi XE2总结 这两天把一个使用Delphi2007成功升级到了Delphi2010.升级途中很艰辛,总结了 以下经验与大家分 ...

  7. 问题-delphi XE2 Stack Overflow- save your work and restart CodeGear

    问题现象:某一天,启动DLEPHI XE2 后,新建一个工程,双击一个事件,"Stack Overflow- save your work and restart CodeGear delp ...

  8. Delphi XE2 新技术说明 (What's new in Delphi XE2)

    今天参加了Delphi XE2的产品发布会,趁热打铁,整理下笔记,看看XE 2中到底有什么新东西. 1. VCL Style 如果你对Web编程很熟,VCL Style就是delphi版的css,想像 ...

  9. delphi xe2 update4及crack下载

    分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow 也欢迎大家转载本篇文章.分享知识,造福人民,实现我们中华民族伟大复兴! RAD ...

最新文章

  1. 【跃迁之路】【425天】刻意练习系列184—SQL(2018.04.06)
  2. 苹果和Siri的七年之痒:Siri的落寞之路
  3. 每日一篇——Fed Unveils Major Expansion of Market Intervention
  4. Linux退出sqlplus界面,Linux CentOS中使用SQL*Plus启动和关闭数据库
  5. [CodeForces 1603C] Extreme Extension(贪心 + 数论分块优化dp)
  6. 37 手游基于 Flink CDC + Hudi 湖仓一体方案实践
  7. 2015第16周四自控力
  8. 光影之路 GPU架构发展史(1/4)
  9. 机器学习-kmeans(k均值聚类算法)
  10. 世界各国大脑计划现状综述,互联网大脑计划系列二
  11. 致敬柳传志三网合一的佳沃品牌之路
  12. 服务器怎么和本地共享文件夹同步,云服务器如何共享文件夹同步
  13. java导出用什么_Java导出Excel
  14. 新一年涨工资指南:AI薪资水平和就业前景分析(一定要看完!)
  15. onkeypress,onkeydown,onkeyup区别
  16. U盘启动盘装系统Win10教程
  17. 银河麒麟系统共享打印机方法
  18. 梦幻西游 python.dll_GitHub - 10508zhl/mhxy: tensorflow实践:梦幻西游人物弹窗识别
  19. 上网使用随身wifi与路由器有何不同?
  20. 苹果cms模板_泛目录站群神器,万词无限模板站群黑帽SEO程序

热门文章

  1. Kotlin 枚举类 enum
  2. 微信小程序做塔防类游戏
  3. 用WinForm做一个简单的计算器
  4. 8Manage SRM:了解采购中的合同管理
  5. npm ERR! code ELIFECYCLE npm ERR! errno 1
  6. 分析称勒索攻击在非洲、中东与中国增长最快
  7. 怎么把jpg转换成docx格式
  8. Microsoft PowerPoint 2019 for Mac 简体中文安装使用手册
  9. Leetcode-69 Sqrt(x)
  10. VS 后期生成事件语法格式