小编Oli*_*ach的帖子

为什么-O2对Haskell中的简单L1距离计算器有如此大的影响?

我使用Haskell实现了一个简单的L1距离计算器.由于我对性能感兴趣,因此我使用未装箱的矢量来存储要比较的图像.

calculateL1Distance :: LabeledImage -> LabeledImage -> Int
calculateL1Distance reference test = 
            let
              substractPixels :: Int -> Int -> Int
              substractPixels a b = abs $ a - b
              diff f = Vec.sum $ Vec.zipWith substractPixels (f reference) (f test)
            in
              diff pixels
Run Code Online (Sandbox Code Playgroud)

据我所知(我是Haskell的新手),流融合应该使这个代码作为一个简单的循环运行.所以它应该很快.但是,编译时性能结果很低

ghc -O -fforce-recomp -rtsopts -o test .\performance.hs
Run Code Online (Sandbox Code Playgroud)

该计划耗时约60秒:

 198,871,911,896 bytes allocated in the heap
   1,804,017,536 bytes copied during GC
     254,900,000 bytes maximum residency (14 sample(s))
       9,020,888 bytes maximum slop
             579 MB total memory in use (0 …
Run Code Online (Sandbox Code Playgroud)

optimization performance haskell nearest-neighbor stream-fusion

10
推荐指数
0
解决办法
172
查看次数

如何在Windows上安装gssapi python模块?

我目前正在尝试让python 的gssapi模块在windows上运行.我的目标是使用python模块ldap3使用Active Directory进行身份验证.gssapi是这项工作的必要条件.但是,安装失败,因为找不到krb5-config.在Linux上,它很容易安装.我安装了Kerberos for Windows,但它没有krb5-config,我在其他地方找不到它(除了Linux).有谁知道在哪里可以找到所需的工具或如何继续(如果可能的话)?

python windows installation kerberos gssapi

6
推荐指数
1
解决办法
2816
查看次数