-- Bernhard Treutwein BdT (at) wildwein de (home) Bernhard Treutwein (at) verwaltung uni-muenchen de (work) ----- Original Message ----- From: "Fyodor Tkachov" <fyodor.tkachov{([at]})nowhere.xyTo: "Blackbox Mailing-List" <blackbox{([at]})nowhere.xySent: Wednesday, January 28, 2004 3:58 PM Subject: CP vs C++ > Hi All! > > I'd like to share an interesting experience -- someone asked a while ago about the cost of array boundary checks etc. > > A pretty complex algorithm was developed in Component Pascal for the needs of physics at CERN (the so-called optimal jet finder). The algorithmic experimentation required was significant, and I cannot imagine how it could have been done within the time it took in Blackbox (4 focused weeks) with any other language. > > The program is not very large, consists of 4 modules and contains a nice mix of normal numerical stuff (arrays, sin's etc.), bit manipulation, records, pointers and lists (the data structures remain static once initialized -- this was possible and needed for the port), true object stuff (so that "dynamic dispatch" had to be used in the C++ version). > So it's quite representative -- on top of being fully real-life. > > Now, since CERN physicists use all possible kinds of hardware, the algorithm was ported to Fortran 77 and recently to C++. > > The C++ version is a straightforward copy of the CP version. > The tests were run on Win XP, and MS Visual C++ compiler was used. > > The C++ variant compiled as a "Debug" version was 3 times slower than CP -- 9.x : 3.6 (sec). > The C++ variant compiled as "Release" with full optimization clocked in at 3.5 sec. > The time measurement fluctuations in all cases was 0.1. > > The compilation time in the last case was noticeable -- must be >10 times more than for CP where it is barely noticeable. > > A CERN C++ guru insists that the resulting C++ code is not good, too many friends and typedefs, etc. -- I am not sure as the CP version is neat and nice, and the earlier Fortran version produced from the same CP original is said to be very good by the same guru. > > So, make your conclusions. > I have no numbers for Fortran yet. > > Cheers > ------------------------- > Fyodor Tkachov > -------------------------------------------- To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to: blackbox-request{([at]})nowhere.xyTo get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address. Send any problem reports or questions related to this email list to the list owner at owner-blackbox{([at]})nowhere.xyCurrent posting policy: a) To post you should use the same address by which you are subscribed to the mailing list. That way, the list server will recognize you as subscriber and forward your posting immediately, without creating any overhead. b) If, for some reason, you cannot post from the address, by which you are subscribed, your message will be moderated to avoid spam. Please understand that moderation will often cause some delay, in particular over weekends or holydays. ----boundary-LibPST-iamunique-1664302169_-_- Content-type: application/rtf Content-transfer-encoding: base64 Content-Disposition: attachment; filename="rtf-body.rtf" e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIFN0cmFzdHdpIEZ5b2RvcixccGFyDQpccGFyDQp0 aGlzIHNvdW5kcyB2ZXJ5IGludGVyZXN0aW5nLiBMZXQgbWUgYXNrIHNvbWUgY3VyaW91cyBxdWVz dGlvbnM6XHBhcg0KXHBhcg0KSG93IHBvcnRhYmxlIGlzIHlvdXIgcHJvZ3JhbT9ccGFyDQpccGFy DQpIb3cgbWFueSBCbGFja0JveCBsaWJyYXJ5IG1vZHVsZXMgYXJlIHVzZWQ/XHBhcg0KXHBhcg0K RG9lcyBpdCBtYWtlIHNlbnNlIHRvIHBvcnQgaXQgb3ZlciB0byBHYXJkZW5zUG9pbnQgQ29tcG9u ZW50XHBhcg0KUGFzY2FsIGFuZCBtYWtlIHNvbWUgZXh0ZW5kaW5nIGNvbXBhcmlzb24gYmV0d2Vl blxwYXINCiJuYXRpdmUiIGlhcHg4NiAoMzJiaXQpIGFuZCAiaW50ZXJwcmV0ZWQiIG9yIGp1c3Qg aW4gdGltZVxwYXINCmNvbXBpbGVkIEphdmEgYnl0ZSBjb2RlIChvbiBtYXliZ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BtYWlsaW5nIGxpc3QuIFRoYXQgd2F5LCB0aGUgbGlz dCBzZXJ2ZXIgd2lsbCByZWNvZ25pemUgeW91IGFzIHN1YnNjcmliZXIgYW5kIGZvcndhcmQgeW91 ciBwb3N0aW5nIGltbWVkaWF0ZWx5LCB3aXRob3V0IGNyZWF0aW5nIGFueSBvdmVyaGVhZC5ccGFy DQpccGFyDQpiKSBJZiwgZm9yIHNvbWUgcmVhc29uLCB5b3UgY2Fubm90IHBvc3QgZnJvbSB0aGUg YWRkcmVzcywgYnkgd2hpY2ggeW91IGFyZSBzdWJzY3JpYmVkLCB5b3VyIG1lc3NhZ2Ugd2lsbCBi ZSBtb2RlcmF0ZWQgdG8gYXZvaWQgc3BhbS4gUGxlYXNlIHVuZGVyc3RhbmQgdGhhdCBtb2RlcmF0 aW9uIHdpbGwgb2Z0ZW4gY2F1c2Ugc29tZSBkZWxheSwgaW4gcGFydGljdWxhciBvdmVyIHdlZWtl bmRzIG9yIGhvbHlkYXl9fQChARAowR6wC1H/ADA= ----boundary-LibPST-iamunique-1664302169_-_---Received on Sun Feb 01 2004 - 00:30:49 UTC
This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:28:57 UTC