Skip to content

dlang 使用经验 #11

Description

@lotusdeng

GC问题

  • GC很原始,详细介绍见葡萄科技的渡世白玉博客http://www.dushibaiyu.com/2017/03/gcandd.html,
    我在使用dlang的vibe库开发了一个DuckServer(httpServer), 接受DuckAgent注册,DuckAgent定时调用注册接口,运行几天下来,DuckServer服务稳定,但是内存7,8百M了,后来调整headSizeFactor为1.0, DuckServer的内存很小了,稳定在10M左右。
  • 一直没找到像go gogctrace那样可以侦察gc变化的功能
  • .exe "--DRT-gcopt=profile:1 minPoolSize:16 heapSizeFactor:1" other paras

CPU profile

  • 打印出所有方法调用的次数已经耗时,可以快速找到瓶颈,方便调优
  • 在程序的dub.json里添加"dflags": ["-profile], 编译程序,运行程序,程序结束时会生成trace.log(阅读不友好)
  • cd 到trace.log所在目录, 执行d-profile-viewer.exe(dub fetch d-profile-viewer and run),会生成trace.html(阅读友好)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions