几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » DirectDWG
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-05-06, 07:33 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】oddbdatabasewritefile slow when writing to a mapped drive

oddbdatabase::writefile slow when writing to a mapped drive
oddbdatabase::writefile slow when writing to a mapped drive
when writing a dxf file to a mapped drive, the performance is very, very slow relative to the local hard disk. i'd expect it to be a little slower but the differential i'm seeing is like 5 seconds local versus 3 minutes to a mapped drive. i'm on windows xp pro with service pack 2. is there something i need to do in the code or is it something with windows xp?
thanks in advance for any help.
dd uses odstreambuf interface for file output. oddbsystemservices::createfile() returns a pointer to object implementing this interface.
exsystemservices::createfile() returns pointer to sample implementation of this interface (see examples/exservices folder).
this is how optimization for different platforms/usage can be implemented.
on windows file output is implemented via writefile() function.
dxf output results in multiple calls to writefile() with small chunks of data. probably writefile() working with mapped drive works slowly in such case and adding a buffering in odstreambuf implementation could help.
on the other hand it may slow down writing to local drive because windows has its own buffering for local drives...
sergey slezkin
thanks sergey for the quick reply. i implemented a buffering scheme and that cured the problem with the mapped drives. thanks for your advice.
after your reply i looked into the problem once more. by default odwrfilebuf(file_name) opens the file with sharing mode denyno. in such case windows can't have local cache (buffer) for mapped drive file (the file may be modified by other computer). as a result file operations are unbuffered and synchronose. if mapped drive file is locked exclusively (denyreadwrite) theoretically windows can have local file buffer.
one of below modifications may help (enable file buffering at system level):
odfilebuf.h
code:
//odwrfilebuf(const odchar file_path) {open(file_path);}
odwrfilebuf(const odchar file_path) {open(file_path, oda::ksharedenyreadwrite);}
or change default value of sharing mode parameter in odwrfilebufen()
or in application code:
code:
//odwrfilebuf file(file_name);
odwrfilebuf file;
file.open(file_name, oda::ksharedenyreadwrite);
sergey slezkin
i gave denyreadwrite a shot thinking that if it worked, a simpler solution is better than my home-grown buffering.
it didn't seem to help.
a simple file through my translator produces a 2,243 kb dxf file. it takes 5 seconds to the local disk and 1 minute 10 seconds to a mapped drive using either denyreadwrite or denyno. with my internal buffering scheme, it takes just slightly longer than 5 seconds to write to the mapped drive.
anyways, i've got a solution that works and i'm happy but probably like you, still curious as to why this is so darn slow.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】displaying the details of hard drives huangyhg vc编程 2 2008-05-03 01:47 PM
文件系统的操作 cad DirectDWG 0 2007-01-28 04:26 PM


所有的时间均为北京时间。 现在的时间是 08:39 AM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多