Open Bug 640024 Opened 13 years ago Updated 2 years ago

Overhead in calling js-ctypes can prevent efficient, repetitive use of it

Categories

(Core :: js-ctypes, defect)

defect

Tracking

()

UNCONFIRMED

People

(Reporter: mimecuvalo, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13
Build Identifier: 

I've created an SSH client in javascript that interfaces with js-ctypes at times.  The two use cases are:
  - creating cryptographically strong random numbers on Windows using CryptGenRandom
  - using NSS to access ciphers (AES, blowfish, etc).

Both of these functions get called many, many times during the course of a session, especially when transferring files through the SFTP protocol.  I have reverted my code to not use NSS since the overhead in calling this function seems to be about ~250ms on my machine (mac, 2ghz).  Instead of using AES in NSS, which I assumed would be faster I'm using a javascript implementation of blowfish.

For the random numbers I have no alternative so I have to use it - I've worked around this issue in the meantime by requesting large swaths of random numbers and caching them so as to avoid making the js-ctypes call.  That code is found here: http://www.mozdev.org/source/browse/fireftp/src/content/js/connection/paramikojs/crypto/Random/OSRNG/nt.js?rev=1.7

I'll post a benchmark shortly showing how NSS is much slower than just using JS encryption.

Reproducible: Always
Attached file Benchmark, NSS vs. JS (obsolete) —
Attached file Benchmark, NSS vs. JS
The old benchmark bitrotted.
Attachment #517901 - Attachment is obsolete: true
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: