Performance in Mac OS X

11 views
Skip to first unread message

Jose Cisneros

unread,
Nov 17, 2009, 9:45:44 AM11/17/09
to Crypto++ Users
Hi all,

I am using cryptopp in Mac OS X, Windows, and Linux (Fedora), and I
have found that the performance to generate RSA keys in Mac OS X is
much slower than in Windows and Fedora. It is like 5 to 10 times
slower. To check this, I used the cryptest.exe file with option "g".

Is this the current behaviour of cryptopp or do I need to add
something else so that the performance is the same in all operating
systems.

I appreciate your help.

Wei Dai

unread,
Nov 17, 2009, 3:47:13 PM11/17/09
to Jose Cisneros, Crypto++ Users
That's because the assembler in Mac OS X is based on a very old version of
GNU AS, which doesn't support .intel_syntax. The assembly code in Crypto++
is written in Intel syntax to be compatible with Microsoft
compilers/assemblers.

--------------------------------------------------
From: "Jose Cisneros" <jacisn...@googlemail.com>
Sent: Tuesday, November 17, 2009 6:45 AM
To: "Crypto++ Users" <cryptop...@googlegroups.com>
Subject: Performance in Mac OS X
> --
> You received this message because you are subscribed to the "Crypto++
> Users" Google Group.
> To unsubscribe, send an email to
> cryptopp-user...@googlegroups.com.
> More information about Crypto++ and this group is available at
> http://www.cryptopp.com.
>

Jose Cisneros

unread,
Nov 17, 2009, 5:05:17 PM11/17/09
to Crypto++ Users
Thank you for the quick response.

Zooko Wilcox-O'Hearn

unread,
Nov 17, 2009, 5:09:19 PM11/17/09
to Wei Dai, Jose Cisneros, Crypto++ Users
On Tuesday, 2009-11-17, at 13:47 , Wei Dai wrote:

> That's because the assembler in Mac OS X is based on a very old
> version of GNU AS, which doesn't support .intel_syntax. The
> assembly code in Crypto++ is written in Intel syntax to be
> compatible with Microsoft compilers/assemblers.


It is indeed a very old version. It calls itself "v1.38". GNU AS
v1.38 was released so long ago that I can't figure out when it was.
It was released before 1996, and probably many years before 1996.

I think that Apple refuses to upgrade to the new GNU assembler
because the new one is under GPLv3 and Apple doesn't like that.

So, I don't know if or how this situation is ever going to be
improved. Apple will patch its ancient version of as to do the new
syntax? Wei Dai will write old-style-syntax variants of all his
assembly just for Mac OS X? Apple will give up and accept GPLv3-
licensed assembler? All Apple users will instead install some open
source operating system on their machines?

I guess what will happen is Crypto++ will continue to be much slower
on Mac OS X than on other systems. Maybe this doesn't matter in
practice. Just how slow is it? Slow enough that it diminishes your
battery life? Slow enough that it worsens the user experience?

Maybe someone who cares about this issue should write to Apple and
request that their assembler support Intel syntax.

Regards,

Zooko

Wei Dai

unread,
Nov 17, 2009, 5:27:08 PM11/17/09
to Crypto++ Users
I'm pretty sure GPLv3 came out way after GNU AS supported .intel_syntax. I
suspect that Apple doesn't want to upgrade because they've made too many
changes to the assembler and don't want to port those changes to a later
version of GNU AS.

I guess it wouldn't hurt to ask Apple directly. Does anyone know if they
have an open source outreach/liason person?

BTW, on 64-bit Mac OS X, the performance difference should be much smaller,
if you compile Crypto++ into a 64-bit binary. (I don't remember if that
happens automatically, or if you have to set some compiler flags.)

--------------------------------------------------
From: "Zooko Wilcox-O'Hearn" <zo...@zooko.com>
Sent: Tuesday, November 17, 2009 2:09 PM
To: "Wei Dai" <wei...@weidai.com>
Cc: "Jose Cisneros" <jacisn...@googlemail.com>; "Crypto++ Users"
<cryptop...@googlegroups.com>
Subject: Re: Performance in Mac OS X

Mouse

unread,
Nov 18, 2009, 7:38:01 AM11/18/09
to Crypto++ Users
Is it possible to configure Crypto++ to use NASM instead of GAS? If so
- any guidance?

I'll post 64-bit Mac OS X numbers later on.

Wei Dai

unread,
Nov 21, 2009, 11:16:42 PM11/21/09
to Mouse, Crypto++ Users
There is no easy way to do this, as far as I can tell. Crypto++ doesn't
actually use GAS directly. It contains inline assembly, which GCC mixes with
assembly code that it generates, and then passes on to the assembler. The
code that GCC generates is in AT&T syntax, which NASM doesn't support, I
think.

BTW, apparently someone is working on getting the latest GAS to work on Mac
OS X. See http://gcc.gnu.org/ml/gcc/2009-09/msg00146.html.

--------------------------------------------------
From: "Mouse" <mous...@gmail.com>
Sent: Wednesday, November 18, 2009 4:38 AM
To: "Crypto++ Users" <cryptop...@googlegroups.com>

Mouse

unread,
Nov 22, 2009, 11:51:11 AM11/22/09
to Wei Dai, Crypto++ Users
I understand. I've compiled NASM on Mac OS X and it seems to pass all the tests.

So while those people are working on porting binutils to Mac OS X - perhaps you could isolate assembly code into separate .s (or .asm) files that e.g. I could feed to NASM? Because since GNU incorporated GAS into binutils, it became a pain-in-the-neck to deal with. I personally think that it was a big mistake and a bad move to fold GAS into the binutils package.

NASM input syntax is said to be "like Intel but with less complexity".

Thanks!

P.S. Here's an older test-run 
cryptopp-bench-560.html
cryptopp-bench-560.html

Jeffrey Walton

unread,
Jul 23, 2015, 8:59:51 PM7/23/15
to Crypto++ Users List
Oh look, its Uri. We have the resident expert with us :)
Reply all
Reply to author
Forward
0 new messages