Groups
Sign in
Groups
Shanghai Linux User Group
Conversations
Labels
About
Send feedback
Help
一个关于haskell程序性能的问题
32 views
Skip to first unread message
Yu Changyuan
unread,
Nov 8, 2014, 7:20:41 AM
11/8/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to shlug
最近碰到一个关于haskell性能的问题,觉得有点奇怪。
程序的功能是简单的处理文本,但是花的时间和文本的长度不呈线性关系。
后来改了版,呈线性了,但不知道为什么,求高手解释。
先上图:
http://showterm.io/973fe885bb3f45ea09e6f#fast
生成测试文本的代码如下:
http://lpaste.net/113931
处理的代码如下:
http://lpaste.net/113932
修改好的代码如下:
http://lpaste.net/113933
--
Best regards,
Changyuan
Yu Changyuan
unread,
Nov 8, 2014, 10:27:05 AM
11/8/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to shlug
做了一个更加容易看明白的版本:
http://lpaste.net/113940
想知道代码里面的genSample为什么计算复杂度不是O(N)的。
--
Best regards,
Changyuan
Chaos Eternal
unread,
Nov 8, 2014, 10:41:05 AM
11/8/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sh...@googlegroups.com
我就想知道 为啥刚才那个链接直接点是去
wx.qq.com
> --
> -- You received this message because you are subscribed to the Google Groups
> Shanghai Linux User Group group. To post to this group, send email to
>
sh...@googlegroups.com
. To unsubscribe from this group, send email to
>
shlug+un...@googlegroups.com
. For more options, visit this group at
>
https://groups.google.com/d/forum/shlug?hl=zh-CN
> ---
> 您收到此邮件是因为您订阅了Google网上论坛中的“Shanghai Linux User Group”论坛。
> 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到
shlug+un...@googlegroups.com
。
> 要查看更多选项,请访问
https://groups.google.com/d/optout
。
Ray Song
unread,
Nov 8, 2014, 12:40:05 PM
11/8/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Yu Changyuan, shlug
length x >= 5 每次對 genSample 求值都會執行,時間複雜度是行數的平方階的
>--
>-- You received this message because you are subscribed to the Google Groups Shanghai Linux User Group group. To post to this group, send email to
sh...@googlegroups.com
. To unsubscribe from this group, send email to
shlug+un...@googlegroups.com
. For more options, visit this group at
https://groups.google.com/d/forum/shlug?hl=zh-CN
>---
>您收到此邮件是因为您订阅了 Google 网上论坛的“Shanghai Linux User Group”论坛。
>要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到
shlug+un...@googlegroups.com
。
>要查看更多选项,请访问
https://groups.google.com/d/optout
。
--
Ray
http://maskray.me
Reply all
Reply to author
Forward
0 new messages