From: worldforge c. <cv...@ma...> - 2000-10-30 13:10:27
|
CVSROOT: /usr/local/worldforge/cvsroot Module name: forge Changes by: aloril 00/10/30 07:52:13 Modified files: libs/Atlas-C++/benchmark: Makefile.am results.txt Added files: libs/Atlas-C++/benchmark: Objects2_Move.cpp Log message: benchmark and results for partially done optimization of Atlas-C++/src/Objects (new Atlas-C++/src/Objects itself is available at http://www.worldforge.net/aloril/atlas/libs/Object_2000-10-30.tar.gz ) It's about 10-60x faster currently than previous version but still incomplete Log of discussion with Alistair Riddoch at #cyphesis follows: (mostly about what changes compared to old Objects) 12:57:07 * aloril is almost there for first incomplete optimized Atlas-C++/Objects 12:57:17 <alriddoch> Woohoo! 12:57:39 * alriddoch has fixed the bug he had with iostreams. 12:57:46 <aloril> cool!! 12:57:48 <aloril> what it was? 12:58:06 <aloril> 47x vs old Atlas-C++/Objects 12:58:30 <aloril> and 14x vs Atlas-C++/Message/Object.h 12:58:46 <aloril> (optimization is not complete, speed should increase considerable when complete) 12:59:02 <aloril> s/considerable/considerably/ 12:59:19 <aloril> above is for creation only, converting movement test right now... 13:02:31 <alriddoch> The problem was because the iostream thought it was a file, so sometimes tried to lseek() on the file descriptor. 13:02:58 <alriddoch> I subclassed filebuf into sockbuf, and override sys_seek() method, so it now does nothing. 13:06:51 <alriddoch> How much code re-working is it going to take to use the new Objects API? 13:07:39 <aloril> not much hopefully 13:07:50 <aloril> most common things: 13:08:08 <aloril> Entity::GameEntity human = Entity::GameEntity::Instantiate(); 13:08:10 <aloril> -> 13:08:22 <aloril> Entity::GameEntityInstance human; 13:08:27 <aloril> and: 13:08:37 <aloril> Object::ListType move_args; 13:08:37 <aloril> move_args.push_back(human.AsObject()); 13:08:37 <aloril> move.SetArgs(move_args); 13:08:41 <aloril> -> 13:09:04 <aloril> vector<Root> move_args(1); 13:09:04 <aloril> move_args[0] = (Root&)human; 13:09:04 <aloril> move->SetArgs(move_args); 13:09:29 <aloril> (and later likely this more optimized version: 13:09:44 <aloril> move->SetArgs0((Root&)human); 13:10:07 <aloril> and later also: 13:12:26 <aloril> Object::ListType vel; 13:12:26 <aloril> vel.push_back(i); 13:12:26 <aloril> vel.push_back(i-1.0); 13:12:26 <aloril> vel.push_back(i+1.0); 13:12:26 <aloril> human->SetVelocity(vel); 13:12:27 <aloril> -> 13:12:37 <aloril> vector<double> vel; 13:12:41 <aloril> vel[0] = i; 13:12:45 <aloril> uups.. 13:12:48 <aloril> vector<double> vel(3); 13:12:51 <aloril> vel[0] = i; 13:12:58 <aloril> vel[1] = i-1.0; 13:13:04 <aloril> vel[2] = i+1.0; 13:13:12 <aloril> human->SetVelocity(vel); 13:15:15 <aloril> oh.. and: 13:15:28 <aloril> human.SetFoo(); 13:15:30 <aloril> -> 13:15:33 <aloril> human->SetFoo(); 13:15:52 <aloril> (like is seen in above examples actually) 13:37:08 <aloril> 66x for movement, 65x for creating move op vs previous Objects 13:37:47 <aloril> 17x, 19x vs Message/Object.h 13:38:06 <aloril> (to be increased from 3-10x) 13:46:27 <alriddoch> That is pretty damn fast. I only hope I can get my head round the API. I am not too good with instances that behave like pointers. 13:47:09 <alriddoch> I assume a move operation is Operations::MoveInstance move; ? 13:47:34 <alriddoch> This should then be treated as if it is a pointer? 13:56:43 <aloril> for all practical purposes you can treat it like python class instance: 13:56:54 <aloril> move2 = move; 13:57:04 <aloril> increases referece, doesn'´t make copy 13:57:18 <aloril> reference is automatically decreased when it goes out of scope 13:57:47 <aloril> (and freed if it was last reference) 13:57:57 <aloril> except with syntax difference: 13:58:08 <aloril> '->' instead of '.' when accessing attributes and 13:59:12 <aloril> ie: obj->SetFoo(value), const type value = obj->GetFoo() and type value& obj->GetFooRef() 13:59:24 <aloril> vs. obj.foo=value and value = obj.foo 14:00:06 <aloril> s/previous/(to be increased by 3-10x)/ 14:00:45 <alriddoch> Hmm, so no leaking hopefullt. 14:00:55 * aloril nods 14:01:20 <alriddoch> Thats good. cyphesis-C++ leaks alot at the moment. 14:02:17 <aloril> hmm... neither Message/Objects.h nor Object/* should leak? 14:04:33 <alriddoch> At the moment Objects are being created with new, but not deleted. 14:04:35 <alriddoch> ;-) 14:05:45 <aloril> ahh.. 14:07:13 <alriddoch> I was going to sort it out, but if I am going to take on new optimised Objects, then there doesn't seem to be much point. 14:07:23 * aloril nods 14:07:48 <aloril> various things not done, but if you want to look already, I can upload it now 14:07:52 <alriddoch> Does Karsten know about the work you are doing? 14:08:15 <alriddoch> aloril: DOn't upload yet. I have loads of stuff I need to be doing for now. 14:08:38 <aloril> don't think karsten knows about it, unless it was mentioned at last meeting 14:09:03 <alriddoch> Might be a good idea to mail karsten to keep him informed. He is working with Atlas-C++ alot at the moment. 14:09:55 <aloril> maybe I'll commit benchamrk and test code to cvs with note that current code is available at http://......tar.gz 14:10:27 * aloril doesn't want to replace current Objects code until it works for transmitting and have ok from you and karsten and other Objects users 14:13:26 <alriddoch> Sounds like a sensible approach. Once it is functionally complete, make a copy available, and then hold a meeting a few days later to discuss it? 14:15:36 <aloril> hmm.. it will get additional optimized and inoptimized interfaces features later, maybe week until it's ready to replace fully 14:20:51 <alriddoch> Time for lunch. cya later. 14:21:08 <aloril> ahh... now reason for only two RootEntityInstance being in freelist is that vector uses copy constructor-> increase ref instead of new objects _______________________________________________ CVS mailing list CV...@ma... http://mail.worldforge.org/lists/listinfo/cvs |