Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZnMessageBenchmark not functional #62

Open
dalehenrich opened this issue Nov 18, 2014 · 0 comments
Open

ZnMessageBenchmark not functional #62

dalehenrich opened this issue Nov 18, 2014 · 0 comments

Comments

@dalehenrich
Copy link
Member

need to implement BlockClosure>>bench. Here's the Pharo implementation:

bench
    "Return how many times the receiver can get executed in 5 seconds.  Answer a meaningful description."
    "[3.14 printString] bench"

    | startTime endTime count roundTo3Digits  |
    roundTo3Digits := [:num |
               | rounded lowDigit |
               rounded := (num * 1000) rounded. "round to 1/1000"
               lowDigit := (rounded numberOfDigitsInBase: 10) - 3. "keep only first 3 digits"
               rounded := rounded roundTo:(10 raisedTo: lowDigit).
               (lowDigit >= 3 or: [rounded \\ 1000 = 0]) "display fractional part only when needed"
                       ifTrue: [(rounded // 1000) asStringWithCommas]
                       ifFalse: [(rounded / 1000.0) printString]].
    count := 0.
    endTime := Time millisecondClockValue + 5000.
    self assert: endTime < SmallInteger maxVal.
    startTime := Time millisecondClockValue.
    [ Time millisecondClockValue > endTime ] whileFalse: [ self value.  count := count + 1 ].
    endTime := Time millisecondClockValue.
    ^count = 1
        ifTrue: [ (roundTo3Digits value: (endTime - startTime) / 1000) , ' seconds.' ]
        ifFalse:  [ (roundTo3Digits value: (count * 1000) / (endTime - startTime)) , ' per second.' ]

This probably deserves to be in GsDevKit base, but I'm working on Issue #53 right now ...

dalehenrich added a commit that referenced this issue Nov 18, 2014
… should be fixed .... of course Issue #61 and Issue #62 were opened to implement the missing behavior
dalehenrich pushed a commit that referenced this issue Dec 4, 2021
Fixed ZnServerSentEvent>>writeOn: to use the latest Zn logging API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant