The Trunk: System-fbs.621.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: System-fbs.621.mcz

commits-2
Frank Shearar uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-fbs.621.mcz

==================== Summary ====================

Name: System-fbs.621
Author: fbs
Time: 24 November 2013, 12:46:55.775 pm
UUID: e2fe5f86-8d22-f843-af93-4a2bfb9aec7c
Ancestors: System-fbs.620

Move LRUCache from System to Collections, because that's a more sensible home.

This also has the nice property that it breaks the Balloon->System dependency.

=============== Diff against System-fbs.620 ===============

Item was removed:
- Object subclass: #LRUCache
- instanceVariableNames: 'size factory calls hits values'
- classVariableNames: ''
- poolDictionaries: ''
- category: 'System-Support'!
-
- !LRUCache commentStamp: '<historical>' prior: 0!
- I'm a cache of values, given a key I return a Value from the cache or from the factory!

Item was removed:
- ----- Method: LRUCache class>>size:factory: (in category 'instance creation') -----
- size: aNumber factory: aBlock
- "answer an instance of the receiver"
- ^ self new initializeSize: aNumber factory: aBlock!

Item was removed:
- ----- Method: LRUCache class>>test (in category 'testing') -----
- test
- "
- LRUCache test
- "
- | c |
- c := LRUCache
- size: 5
- factory: [:key | key * 2].
- c at: 1.
- c at: 2.
- c at: 3.
- c at: 4.
- c at: 1.
- c at: 5.
- c at: 6.
- c at: 7.
- c at: 8.
- c at: 1.
- ^ c!

Item was removed:
- ----- Method: LRUCache class>>test2 (in category 'testing') -----
- test2
- "
- LRUCache test2.  
- Time millisecondsToRun:[LRUCache test2].
- MessageTally spyOn:[LRUCache test2].  
- "
- | c |
- c := LRUCache
- size: 600
- factory: [:key | key * 2].
- 1
- to: 6000
- do: [:each | c at: each].
- ^ c!

Item was removed:
- ----- Method: LRUCache>>at: (in category 'accessing') -----
- at: aKey
- "answer the object for aKey, if not present in the cache creates it"
- | element keyHash |
- calls := calls + 1.
- keyHash := aKey hash.
- 1
- to: size
- do: [:index |
- element := values at: index.
- (keyHash
- = (element at: 2)
- and: [aKey
- = (element at: 1)])
- ifTrue: ["Found!!"
- hits := hits + 1.
- values
- replaceFrom: 2
- to: index
- with: (values first: index - 1).
- values at: 1 put: element.
- ^ element at: 3]].
- "Not found!!"
- element := {aKey. keyHash. factory value: aKey}.
- values
- replaceFrom: 2
- to: size
- with: values allButLast.
- values at: 1 put: element.
- ^ element at: 3!

Item was removed:
- ----- Method: LRUCache>>initializeSize:factory: (in category 'initialization') -----
- initializeSize: aNumber factory: aBlock
- "initialize the receiver's size and factory"
- size := aNumber.
- values := Array new: aNumber withAll: {nil. nil. nil}.
- factory := aBlock.
- calls := 0.
- hits := 0!

Item was removed:
- ----- Method: LRUCache>>printOn: (in category 'printing') -----
- printOn: aStream
- "Append to the argument, aStream, a sequence of characters
- that identifies the receiver."
- aStream nextPutAll: self class name;
- nextPutAll: ' size:';
- nextPutAll: size asString;
- nextPutAll: ', calls:';
- nextPutAll: calls asString;
- nextPutAll: ', hits:';
- nextPutAll: hits asString;
- nextPutAll: ', ratio:';
- nextPutAll: ((hits isNumber and: [calls isNumber and: [calls ~= 0]])
- ifTrue: [hits / calls]
- ifFalse: [0]) asFloat asString!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: System-fbs.621.mcz

Frank Shearar-3
On 24 November 2013 12:51,  <[hidden email]> wrote:
> Frank Shearar uploaded a new version of System to project The Trunk:
> http://source.squeak.org/trunk/System-fbs.621.mcz
>
> ==================== Summary ====================

This is probably because source.squeak.org is a little busy: I got
socket errors on uploading, so repeated the request. Apparently the
errors happened after the mcz made it to source.squeak.org? I hope so,
at any rate. For extra oddness points, the debugger closed by itself,
so I can't say what the exact nature of the error was.

frank

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: System-fbs.621.mcz

David T. Lewis
On Sun, Nov 24, 2013 at 01:04:12PM +0000, Frank Shearar wrote:

> On 24 November 2013 12:51,  <[hidden email]> wrote:
> > Frank Shearar uploaded a new version of System to project The Trunk:
> > http://source.squeak.org/trunk/System-fbs.621.mcz
> >
> > ==================== Summary ====================
>
> This is probably because source.squeak.org is a little busy: I got
> socket errors on uploading, so repeated the request. Apparently the
> errors happened after the mcz made it to source.squeak.org? I hope so,
> at any rate. For extra oddness points, the debugger closed by itself,
> so I can't say what the exact nature of the error was.
>
> frank

The System-fbs.621.mcz upload looks fine from here.

Upload failures used to be common on squeaksource.com before we moved
it to squeak.org. Fortunately, Monticello saves the file first to the
local package-cache repository, so the fix for a failed upload was just
to copy the good mcz from package-cache to the squeaksource repository.

Dave