[Cuis-dev] Slow execution

lewis at mail.msen.com lewis at mail.msen.com
Sat Oct 10 06:45:40 PDT 2026


Hi Luis,

You are right in thinking that the time is going into the Transcript.

For both Cuis and Squeak, a better approach is to collect your test 
results without interacting with the Transcript, like this:

| results startTime elapsed potentialPrimes limit |
results := OrderedCollection new. "Collect test results in a collection, 
not in the Transcript"

startTime := Time millisecondClockValue.

limit := 100.
potentialPrimes := Array new: limit.
potentialPrimes atAllPut: true.

2 to: limit sqrt floor do: [:testNumber |
     (potentialPrimes at: testNumber) ifTrue: [
         (testNumber squared) to: limit by: testNumber do: [:nonPrime |
             potentialPrimes at: nonPrime put: false
         ]
     ]
].

2 to: limit do: [:testNumber |
     (potentialPrimes at: testNumber) ifTrue: [
         "Transcript show: testNumber asString; cr"
     results add: testNumber.
     ]
].

elapsed := Time millisecondClockValue - startTime.
results add: elapsed.
"After the test is complete, you can show the results in Transcript"
results allButLast do: [ :e | Transcript show: e asString; cr ].
Transcript show: elapsed printString; show: ' ms'; cr.
results inspect.

HTH,

Dave

On 2026-10-10 09:36, Luis Mendes via Cuis-dev wrote:

> Hi,
> 
> I'm evaluating Cuis as a programming language for my use.
> Smalltalk seems like a great environment to program.
> But I need that programs can execute fast.
> 
> I did some non-rigorous benchmark to some languages for a CPU intensive
> operation.
> The language that I've been using is Tcl.  It's slow for some kind of
> operations, and I will need a language that can go through lots of 
> data.
> 
> Used Python just because it is so popular.
> 
> Used Euphoria because it's a simple language that runs fast.  Faster
> yet when translated to C, but I didn't test the speed after this
> operation.
> 
> Also tested Icon because it's compiled, has great tools for text
> related operations, and can also run on MS-DOS, as can Euphoria, in
> case I decide to also use this focused environment to program.
> 
> For the Erathostenes code found on Rosettacode, these are the results I
> got:
> 
> 1.000.000 times                milliseconds
> 
> eratosthenes2.eu              70
> eratosthenes2.eu              90
> eratosthenes_generator.py         114
> eratosthenes_array.py             121
> eratosthenes_set.py                  253
> eratosthenes.icn                 700
> eratosthenes_sets.icn             580
> eratosthenes.tcl            2112
> eratosthenes2.tcl            4792
> cuis 5.0 2021               27472
> cuis 7.9 2026                2093
> squeak6.2 alpha 24031               66
> 
> The Smalltalk code used was this one:
> 
> | startTime elapsed potentialPrimes limit |
> startTime := Time millisecondClockValue.
> 
> limit := 100.
> potentialPrimes := Array new: limit.
> potentialPrimes atAllPut: true.
> 
> 2 to: limit sqrt floor do: [:testNumber |
> (potentialPrimes at: testNumber) ifTrue: [
> (testNumber squared) to: limit by: testNumber do: [:nonPrime |
> potentialPrimes at: nonPrime put: false
> ]
> ]
> ].
> 
> 2 to: limit do: [:testNumber |
> (potentialPrimes at: testNumber) ifTrue: [
> Transcript show: testNumber asString; cr
> ]
> ].
> 
> elapsed := Time millisecondClockValue - startTime.
> Transcript show: elapsed printString; show: ' ms'; cr.
> 
> What I found is that printing the numbers in a window is very slow for
> Cuis, maybe the difference is entirely related to it.
> Something like 60-70 ms, like in Squeak would be great.
> 
> Any comments?
> 
> Thank you,
> 
> Luís Mendes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20261010/39b4a84e/attachment.htm>


More information about the Cuis-dev mailing list