SERVING THE QUANTITATIVE FINANCE COMMUNITY

 
User avatar
Cuchulainn
Topic Author
Posts: 63263
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Architecture and Design

October 23rd, 2011, 2:47 pm

Quote2.b) Performance. In this particular domain we need to have performance as an important design element. Sometimes a design pattern might call for a double indirection, which would hit performance.These remarks worry me. We should not make decisions without first measuring (remember my virtual function thread?)We can 1. use CRTP (static polymorphism)2. use OO approach and see if performance is OK (run-time polymorphism)3. use boost (NO run-time polymorphism)Fear of potential performance problems is not a reason to jump to Plan B. What about Paul who wishes to experiment with new schemes? BTW some quants use C# who don't care if it is a bit slower than C++ because productivity > 3 times higher than with C++.Again, you need to know your target groups. Tailor your code accordingly.
Last edited by Cuchulainn on October 22nd, 2011, 10:00 pm, edited 1 time in total.
Chips chips chips Du du du du du Ci bum ci bum bum Du du du du du Ci bum ci bum bum Du du du du du
http://www.datasimfinancial.com
http://www.datasim.nl
 
User avatar
Polter
Posts: 2526
Joined: April 29th, 2008, 4:55 pm

Architecture and Design

October 23rd, 2011, 3:14 pm

Cuch, naturally ProfileBeforeOptimizing goes without saying.At the same time: Herb Sutter, Andrei Alexandrescu, C++ Coding Standards: 101 Rules, Guidelines, and Best Practices, Item 9. Don't pessimize prematurely."Yet we should not pass up our opportunities in that critical 3%." (hence the profiling)E.g., DesignForPerformanceSee the discussion in PrematureOptimization -- in particular, the paragraph:"However, PrematureOptimization can be defined (in less loaded terms) as optimizing before we know that we need to.Optimizing up front is often regarded as breaking YouArentGonnaNeedIt (YAGNI). But by the time we decide that we need to optimize, we might be too close to UniformlySlowCode to OptimizeLater. We can use PrematureOptimization as a RiskMitigation strategy to push back the point of UniformlySlowCode, and lower our exposure to the risk of UniformlySlowCode preventing us from reaching our performance target with OptimizeLater.For those who don't work to strict memory or CPU cycle limits, PrematureOptimization is an AntiPattern, since there is only cost and no benefit. For those who do, it is often confused with poor coding, or with misguided attempts at writing optimal code.A common misconception is that optimized code is necessarily more complicated, and that therefore optimization always represents a trade-off. However, in practice, better factored code often runs faster and uses less memory as well. In this regard, optimization is closely related to refactoring, since in both cases we are paying into the code so that we may draw back out again later if we need to. We don't (yet) have PrematureRefactoring regarded as CategoryEvil.Another common misconception is that any level of execution speed, or resource usage, can be achieved once the code is complete. There are both practical and physical limits given any target platform. PrematureOptimization is not a solution to this, but it can help us DesignForPerformance. When working in an environment where resources are less limited, this is unlikely to be a problem. "Target architecture is important: for instance, if we want to have a code highly scalable w.r.t. massive paralellism on GPUs, a DesignForPerformance would probably require avoiding mutable shared states -- precisely what would hurt the performance on current CPUs. Hence, I don't think there are fixed sweet spots that we could just put in the big-design-up-front. Identifying the moving parts (mutable shared states) and the differences that cause them to be moving (target architecture: CPUs vs. GPUs) might lead to a better design overall.And we shouldn't forget what we know: there was a thread here that has done some profiling on QuantLib code and identified the performance bottlenecks -- AFAIR, those were multiple virtual fn. calls and the removal brought a significant speedup -- using what we know from this is not necessarily "making decisions without first measuring", agreed?
Last edited by Polter on October 22nd, 2011, 10:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 63263
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Architecture and Design

October 23rd, 2011, 3:16 pm

QuoteOriginally posted by: outrunLet's get some toy problem working so that we can check all implications.What kind of implications? This approach is only good to discover requirements and tends to be sub-optimal.
Chips chips chips Du du du du du Ci bum ci bum bum Du du du du du Ci bum ci bum bum Du du du du du
http://www.datasimfinancial.com
http://www.datasim.nl
 
User avatar
Cuchulainn
Topic Author
Posts: 63263
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Architecture and Design

October 23rd, 2011, 3:18 pm

Polter,I agree, this is part of detailed design. But I am talking about 2 steps before that, for example software product design I want to map to C++, C# and Matlab as already mentioned. For a large group, design for extensibility is more important than squeezing out the last ms.
Last edited by Cuchulainn on October 22nd, 2011, 10:00 pm, edited 1 time in total.
Chips chips chips Du du du du du Ci bum ci bum bum Du du du du du Ci bum ci bum bum Du du du du du
http://www.datasimfinancial.com
http://www.datasim.nl
 
User avatar
Cuchulainn
Topic Author
Posts: 63263
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Architecture and Design

October 23rd, 2011, 3:44 pm

Quotenot just abstract diagramsIn Dutch, 'abstract' has a negative connotation because programmers like 'doing' things. Are you using the English meaning?Every discipline - except software - uses abstact diagrams before embarking on implementation. So, what's up with s/w?QuoteWhy are you against testing your design?? Did I say that? Have a look at the Spiral model diagram.Large, long lifetime, complex systems cannot be realised by the approach you suggest.
Last edited by Cuchulainn on October 22nd, 2011, 10:00 pm, edited 1 time in total.
Chips chips chips Du du du du du Ci bum ci bum bum Du du du du du Ci bum ci bum bum Du du du du du
http://www.datasimfinancial.com
http://www.datasim.nl
 
User avatar
Cuchulainn
Topic Author
Posts: 63263
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Architecture and Design

October 23rd, 2011, 3:59 pm

QuoteOriginally posted by: outrunSimple C++ toy code compiles, the diagrams dont.You can make toy problems with the same effort as drawing these diagrams, in sure there are tool that can generate these diagram from code for you, *and* -like you said- lost people find it easier to judge code than diagrams.This is the core issue and is errroneous; if you reverse engineer QL to UML you get a maze?We work with many designers who are able to create UML and then map to C++. Many progammers have not learned this.Maybe have a look at best-in-class software systems (telecom, medical, ...) where these patterns are used.
Chips chips chips Du du du du du Ci bum ci bum bum Du du du du du Ci bum ci bum bum Du du du du du
http://www.datasimfinancial.com
http://www.datasim.nl
 
User avatar
Cuchulainn
Topic Author
Posts: 63263
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Architecture and Design

October 23rd, 2011, 4:03 pm

QuoteCan we say that you draft design is ready, and let's move on to the test. The code V1 is ready, indeed. But I want to document it in chapter form and not a doxygen doc only.One issue is code copyright and giving it away to all and sundry.QuoteWe need to avaid large complex monolithic systems *at all cost*. Your word 'monolithic', not mine.
Last edited by Cuchulainn on October 22nd, 2011, 10:00 pm, edited 1 time in total.
Chips chips chips Du du du du du Ci bum ci bum bum Du du du du du Ci bum ci bum bum Du du du du du
http://www.datasimfinancial.com
http://www.datasim.nl
 
User avatar
Cuchulainn
Topic Author
Posts: 63263
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Architecture and Design

October 23rd, 2011, 4:31 pm

QuoteRegarding my first question: "What are you making a design for?" maybe you are designing a standalone FDE module? If we define clear interfaces than the internal architecture should affect other modules, and then thus whole discussion becomes less important.If only it were so easy. I am desiging with flexibility in mind, front up. So that users can experiment with their own own models. And just programming will not help. You make s/w development sound so easy.My approach addresses the following user requirement. I make it easier by doing the plumbing and providing slots that users can hook into. It's not rocket science anymore.Quote3. Encouraging other people to try new models: Almost everyone, bar me, wants off-the-shelf programs. If they have to implement anything themselves then they are put off by complicated numerics, especially FDM! They are ok with MC usually, even though few of them properly understand the relationship between MC, risk neutrality and valuation! Also unless a critical mass of people use a technique then others are usually reluctant to try it out. And a method is usually only adopted if it is a trivial change to something that has already been widely adopted. So if some more sophisticated numerics and models can be found off-the-shelf this might encourage more innovation in quant finance.
Last edited by Cuchulainn on October 22nd, 2011, 10:00 pm, edited 1 time in total.
Chips chips chips Du du du du du Ci bum ci bum bum Du du du du du Ci bum ci bum bum Du du du du du
http://www.datasimfinancial.com
http://www.datasim.nl
ABOUT WILMOTT

PW by JB

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...


Twitter LinkedIn Instagram

JOBS BOARD

JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...


GZIP: On