added throughput test example
authorClaus Gittinger <cg@exept.de>
Tue, 19 Oct 1999 01:00:28 +0200
changeset 4916 df965a3448b9
parent 4915 41d5b675769a
child 4917 662e7f3315fb
added throughput test example
SHA1Stream.st
--- a/SHA1Stream.st	Mon Oct 18 23:05:39 1999 +0200
+++ b/SHA1Stream.st	Tue Oct 19 01:00:28 1999 +0200
@@ -318,6 +318,8 @@
     This may be used as checksum
     or for generating cryptographic signatures.
 
+    performance: roughly 9580KbKb/s on a 400Mhz PIII
+
     [author:]
         Stefan Vogel
 
@@ -391,6 +393,22 @@
     hashStream nextPut:$a.
     hashStream hashValue printOn:Transcript base:16. Transcript cr.
                                                                 [exEnd]
+
+  timing throughput:
+                                                                [exBegin]
+    |hashStream n t|
+
+    hashStream := SHA1Stream new.
+    n := 1000000.
+    t := Time millisecondsToRun:[
+            n timesRepeat:[
+                hashStream nextPutAll:'12345678901234567890123456789012345678901234567890'.
+            ].
+         ].
+    t := (t / 1000) asFloat.
+    Transcript show:t; show:' seconds for '; show:(50*n/1024) asFloat; showCR:' Kb'.
+    Transcript show:(n*50/1024 / t); showCR:' Kb/s'
+                                                                [exEnd]
 "
 ! !
 
@@ -575,6 +593,6 @@
 !SHA1Stream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/SHA1Stream.st,v 1.4 1999-09-23 18:33:47 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/SHA1Stream.st,v 1.5 1999-10-18 23:00:28 cg Exp $'
 ! !
 SHA1Stream initialize!