Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: Macro To Ge...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 18 Topic 9553 of 9775
Post > Topic >>

Re: Macro To Generate Inline Assembly

by Le Chaud Lapin <jaibuduvin@[EMAIL PROTECTED] > Apr 28, 2008 at 04:06 PM

On Apr 28, 3:13 am, Tony Delroy <tony_in_da...@[EMAIL PROTECTED]
> wrote:
> On Apr 27, 10:29 pm, Le Chaud Lapin <jaibudu...@[EMAIL PROTECTED]
> wrote:
>
> > "Premature optimization is the root of all evil."
> > So I waited until my (big) Integer class was sufficiently mature
> > before optimizing it.
>
> That may still be premature.  Profiling should generally be the
> trigger for optimising, though of course if your responsibility ends
> at delivering a "big int" library, it's reasonable to go that bit
> further and benchmark alternative implementations before waiting for
> customer complaints....

True, but there are some situations where one knows well in advance,
even before the project begins, that small pieces of the code will
need to be optimized manually. This is one such situation.

In fact, I will probably not use a profiler to profile my code,
because I already know where the bottlenecks are.

Not suprisingly, every fast Big Integer implementation I have seen
follows the same pattern: they write most of the code in ****table C++,
then replace a few critical operations in with assembly.  The
difference in speed can be dramatic because there of the very nature
of the operations.

Take the simple operation of computing [unsigned int] + [unsigned int]
on a 32-bit machine with carry-detection.  There is no trickery in C++
that can be done to achieve the efficiency of hand-crafted inline
__asm.

Normally, this would not be an issue, but in the case of Big Integer,
it matters greatly, especially for divide-with-remainder and multiply
operations.

-Le Chaud Lapin-


-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 18 Posts in Topic:
Macro To Generate Inline Assembly
Le Chaud Lapin <jaibud  2008-04-27 07:29:36 
Re: Macro To Generate Inline Assembly
=?ISO-8859-1?Q?Daniel_Kr=  2008-04-27 12:39:09 
Re: Macro To Generate Inline Assembly
Le Chaud Lapin <jaibud  2008-04-27 12:39:05 
Re: Macro To Generate Inline Assembly
Tony Delroy <tony_in_d  2008-04-28 02:13:23 
Re: Macro To Generate Inline Assembly
Le Chaud Lapin <jaibud  2008-04-28 16:06:49 
Re: Macro To Generate Inline Assembly
Mathias Gaunard <loufo  2008-04-28 20:34:54 
Re: Macro To Generate Inline Assembly
Le Chaud Lapin <jaibud  2008-04-28 23:23:12 
Re: Macro To Generate Inline Assembly
=?ISO-8859-1?Q?Daniel_Kr=  2008-04-29 10:35:49 
Re: Macro To Generate Inline Assembly
Francis Glassborow <fr  2008-04-29 10:43:23 
Re: Macro To Generate Inline Assembly
Le Chaud Lapin <jaibud  2008-04-29 17:38:48 
Re: Macro To Generate Inline Assembly
Le Chaud Lapin <jaibud  2008-04-29 17:42:22 
Re: Macro To Generate Inline Assembly
galathaea <galathaea@[  2008-04-29 18:29:42 
Re: Macro To Generate Inline Assembly
Carl Barron <cbarron41  2008-04-30 04:13:23 
Re: Macro To Generate Inline Assembly
Mathias Gaunard <loufo  2008-04-30 04:13:22 
Re: Macro To Generate Inline Assembly
Le Chaud Lapin <jaibud  2008-04-30 10:42:39 
Re: Macro To Generate Inline Assembly
John Nagle <nagle@[EMA  2008-05-03 06:13:27 
Re: Macro To Generate Inline Assembly
Le Chaud Lapin <jaibud  2008-05-03 16:10:43 
Re: Macro To Generate Inline Assembly
Le Chaud Lapin <jaibud  2008-05-03 16:13:24 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Jul 8 23:46:42 CDT 2008.