Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.glorb.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: George Neuner Newsgroups: comp.compilers Subject: Re: How to Optimize a Black Box Date: Fri, 24 Mar 2017 22:05:38 -0400 Organization: A noiseless patient Spider Lines: 70 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <17-03-012@comp.compilers> References: <17-03-010@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit Injection-Info: miucha.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="39305"; mail-complaints-to="abuse@iecc.com" Keywords: code, optimize Posted-Date: 27 Mar 2017 22:37:32 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:1833 On Fri, 24 Mar 2017 12:22:56 +0530, Seima Rao wrote: > In our software development process, we decided that we will > be using Open Source libraries as a plug-in into our software. > > Permissive licenses like BSD, MIT & Apache allow us > some freedom in redistributing the code for commercial purposes. > > However, when cutting across licensing options, one is often > held due to a library(Open Source) as a black box. > > Since we are plugging in a third party library, at some point > of time in the future, we envision visiting it to optimize > starting with the hotpath and then meandering into > the visible items in a profile. > > My question is how do we start at all in optimizing a black box ? In some sense, that is a "system engineering" question. If you have source, you can *try* compiling with different optimizations (vs the vendor's preferred build). But there is no guarantee that you actually will improve performance, and a very real possibility that a different set of optimizations might break the code. If you don't have - or can't modify - the source, then you have to look to hardware solutions: faster cores and/or larger caches for serial code, more cores for parallel code, more RAM for more RAM, SSDs vs spinning disks, etc. What you need depends on what overall performance you want to achieve. Even without source, you often can infer from operation whether code is serial or parallel. [In this context, SIMD should be considered "serial" needing a faster core, vs multi-{thread|process} "parallel" that can use more cores.] > Because these open source initiatives have become synonymous > with business (someone using them for commercial purposes) in > many countries, I suspect that many have felt the need to > "peek inside" as well as "work from the outside". > > Can anyone help ? > > p.s. Rewrite is an option but still ... You need to be careful with the "rewrite" option too. The license may, in general, give you the right to modify the code, but there may be some specific provision or technicality that will prevent you from doing exactly what you want. Even if the license itself is ok, there may still be copyright and/or attribution issues - e.g., you don't own the API your code implements. Occasionally also there may be (software) patent issues to consider. Just to be safe ... particularly for business use ... if you really feel you need to rewrite/redesign the library, then you should get your lawyers involved. Even if the intended use currently is private, you need to be concerned about the future: e.g., what happens if your modified library becomes public and comes to the attention of the library vendor or its contributers? YMMV, George