<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>编程 :: 标签 :: yafeng 的博客</title>
    <link>https://yafengabc.github.io/tags/%E7%BC%96%E7%A8%8B/index.html</link>
    <description></description>
    <generator>Hugo</generator>
    <language>zh-cn</language>
    <lastBuildDate>Sat, 19 Sep 2026 16:30:07 +0800</lastBuildDate>
    <atom:link href="https://yafengabc.github.io/tags/%E7%BC%96%E7%A8%8B/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Nim 入门之基于对话框的简单的GUI程序的编写</title>
      <link>https://yafengabc.github.io/cnblogs/p17229429/index.html</link>
      <pubDate>Sat, 18 Mar 2023 09:55:00 +0800</pubDate>
      <guid>https://yafengabc.github.io/cnblogs/p17229429/index.html</guid>
      <description>最近Golang玩的很嗨，现代的C语言不是盖的。唯一有点不爽的就是golang是专为高并发设计的，每次启动都一堆线程。在htop下看着很不爽。有没有一种写起来爽，又是编译型语言，速度也可以的语言呢？&#xA;当然有，Nim算是其中之一吧。并且这个语言比较像Python，也是缩进语法的语言。先来个例子感受下语法：&#xA;import time def fib(n): if n==0: return 0 if n==1: return 1 return fib(n-1)+fib(n-2) t=time.time() print(fib(40)) print(time.time()-t) 错了错了，这是python。下边才是Nim&#xA;import times proc fib(n:int):int= if n==0: return 0 if n==1: return 1 return fib(n-1)+fib(n-2) var t=times.cpuTime() echo fib(40) echo times.cputime()-t 可以看到是不是有点像Golang跟python的结合体？&#xA;顺便贴一下测试结果：&#xA;[yafeng@SongSrv fibn]$ python fib.py 102334155 69.87282729148865 [yafeng@SongSrv fibn]$ pypy3 fib.py 102334155 13.181118726730347 [yafeng@SongSrv fibn]$ go run fib.go 102334155 1.237680831s [yafeng@SongSrv fibn]$ g++ fib.cpp &amp;&amp; ./a.out 102334155 1.99962 sec [yafeng@SongSrv fibn]$ g++ -O3 fib.cpp &amp;&amp; ./a.out秒， 102334155 0.373478 sec [yafeng@SongSrv fibn]$ nim r fib.nim 102334155 3.16008495 [yafeng@SongSrv fibn]$ nim -d:release r fib.nim 102334155 1.067569256 [yafeng@SongSrv fibn]$ nim -d:danger r fib.nim 102334155 0.017291094 python 70秒，pypy 13秒，go 1.2秒，g++不优化2秒，优化0.3秒。</description>
    </item>
  </channel>
</rss>