[Coin-discuss] Small patch for OsiMsk
Stefan Vigerske
stefan at math.hu-berlin.de
Thu Mar 10 06:24:01 EST 2016
Hi,
yes, that makes sense, and similar for MSKassert().
I committed this change with rev 2085:
https://projects.coin-or.org/Osi/changeset/2085/
Thanks,
Stefan
On 03/10/2016 04:05 AM, Geoff Leyland wrote:
> Hi,
>
> OsiMskSolverInterface.cpp contains this function:
>
> static inline void
> checkMSKerror( int err, std::string mskfuncname, std::string osimethod )
> {
> if( err != MSK_RES_OK )
> {
> char s[100];
> sprintf( s, "%s returned error %d", mskfuncname.c_str(), err );
> std::cout << "ERROR: " << s << " (" << osimethod <<
> " in OsiMskSolverInterface)" << std::endl;
> throw CoinError( s, osimethod.c_str(), "OsiMskSolverInterface" );
> }
> }
>
> From every callsite in the file, it is called with const char * arguments. std::strings are constructed from these const char *s which are then used as, you guessed it, const char *s through c_str(). As far as I can tell, with the standard "make", these constructor calls are not optimised out.
>
> I have inherited a code which runs many thousands of small LPs, and spends about as much time constructing problems as solving them. Changing the definition of checkMSKerror to:
>
> static inline void
> checkMSKerror( int err, const char *mskfuncname, const char *osimethod )
>
> and removing the c_str()s pretty much halves the construction time, and saves about 30s on a 3-minute run.
>
> Would anyone with permissions be interested in committing such a patch? Or can I send a pull request from the github mirror - I'm assuming that's read-only?
>
>
> Cheers,
> Geoff
>
>
> _______________________________________________
> Coin-discuss mailing list
> Coin-discuss at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/coin-discuss
>
--
http://www.gams.com/~stefan
More information about the Coin-discuss
mailing list