digitalmars.D.learn - Can we turn off array's bounds-check?
- "uframer" <uframer sina100.com.cn> May 24 2005
- clayasaurus <clayasaurus gmail.com> May 24 2005
- "uframer" <uframer sina100.com.cn> May 25 2005
- "Unknown W. Brackets" <unknown simplemachines.org> May 25 2005
- "Ben Hinkle" <ben.hinkle gmail.com> May 25 2005
- David Medlock <noone nowhere.com> May 25 2005
- "uframer" <uframer sina100.com.cn> May 25 2005
- pragma <pragma_member pathlink.com> May 25 2005
- Dave <Dave_member pathlink.com> May 25 2005
- "uframer" <uframer sina100.com.cn> May 27 2005
I find it's disturbing when i'm using D in the program for my thesis. In an ant-based algorithm the basic operation is array access, it will be called even over 10e8 times! So you guys know why i want to turn the check off. Any ideas?
May 24 2005
uframer wrote:I find it's disturbing when i'm using D in the program for my thesis. In an ant-based algorithm the basic operation is array access, it will be called even over 10e8 times! So you guys know why i want to turn the check off. Any ideas?
Have you tried passing the -release and -O options to the dmd compiler?
May 24 2005
Yes, i have tried that, but the effect is unclear. The D program's time consumption is about 10 times of the cpp one's. Sigh! "clayasaurus" <clayasaurus gmail.com> ??????:d70som$675$1 digitaldaemon.com...uframer wrote:I find it's disturbing when i'm using D in the program for my thesis. In an ant-based algorithm the basic operation is array access, it will be called even over 10e8 times! So you guys know why i want to turn the check off. Any ideas?
Have you tried passing the -release and -O options to the dmd compiler?
May 25 2005
How are you doing it? Using -release should turn off array boundary checking. Have you tried -inline as well? -[Unknown]Yes, i have tried that, but the effect is unclear. The D program's time consumption is about 10 times of the cpp one's. Sigh!
May 25 2005
"uframer" <uframer sina100.com.cn> wrote in message news:d71btq$1s3u$1 digitaldaemon.com...Yes, i have tried that, but the effect is unclear. The D program's time consumption is about 10 times of the cpp one's. Sigh!
Compile with -profile and look at trace.log to see where the time goes. You'll probably want to run profiled builds on smaller problems than a release build since tracing adds lots of overhead to the app.
May 25 2005
uframer wrote:I find it's disturbing when i'm using D in the program for my thesis. In an ant-based algorithm the basic operation is array access, it will be called even over 10e8 times! So you guys know why i want to turn the check off. Any ideas?
for most arrays there is a property .ptr char[100] mychars; char* p = mychars.ptr; The pointer does not have a bounds check i believe.
May 25 2005
Thank you all! I think i have fixed the problem. "uframer" <uframer sina100.com.cn> 写入消息新闻:d70qtf$1gv$1 digitaldaemon.com...I find it's disturbing when i'm using D in the program for my thesis. In an ant-based algorithm the basic operation is array access, it will be called even over 10e8 times! So you guys know why i want to turn the check off. Any ideas?
May 25 2005
In article <d720ps$2pcd$1 digitaldaemon.com>, uframer says...Thank you all! I think i have fixed the problem. "uframer" <uframer sina100.com.cn> 写入消息新闻:d70qtf$1gv$1 digitaldaemon.com...I find it's disturbing when i'm using D in the program for my thesis. In an ant-based algorithm the basic operation is array access, it will be called even over 10e8 times! So you guys know why i want to turn the check off. Any ideas?
Please, share your solution. We'd all like to learn how to better overcome such problems in our own code. :) - EricAnderton at yahoo
May 25 2005
In article <d725kb$2tuf$1 digitaldaemon.com>, pragma says...In article <d720ps$2pcd$1 digitaldaemon.com>, uframer says...Thank you all! I think i have fixed the problem. "uframer" <uframer sina100.com.cn> 写入消息新闻:d70qtf$1gv$1 digitaldaemon.com...I find it's disturbing when i'm using D in the program for my thesis. In an ant-based algorithm the basic operation is array access, it will be called even over 10e8 times! So you guys know why i want to turn the check off. Any ideas?
Please, share your solution. We'd all like to learn how to better overcome such problems in our own code. :) - EricAnderton at yahoo
Yes - and also please post the two sets of source code along with the different performance measurements you got. This would be interesting to many of us as well. - Dave
May 25 2005
Oops, i'm really a bad coder! I think i should apologize for the blame on D. The performance problem does not mainly come from difference between D and Cpp, but from a subtle structure difference between the two versions that would alter the ants' random behavior significantly.:( And , -release helps, it reduces the time consumption by about 30%.
May 27 2005









"Unknown W. Brackets" <unknown simplemachines.org> 