Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0007166 [Squeak] Kernel tweak always 08-27-08 21:43 04-18-10 21:59
Reporter Keith_Hodges View Status public  
Assigned To
Priority normal Resolution open Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.10.2bc Product Version 3.10.2
  Product Build
Summary 0007166: speedup allSelectors add allSelectorsBelow:
Description Firstly #allSelectors inefficiently creates multiple intermediate collections. Refactoring this yields a 27% speed improvement.

Secondly many users of #allSelectors forget that when applied to the class side it doesnt stop at ProtoObject class, it continues to Class ClassDescription, Behavior, Object and ProtoObject. This is catered for by adding #allSelectorsBelow:

Magritte and SUnit are heavy users which benefit.
Steps To Reproduce
Additional Information
Attached Files  Speedup-AllSelectors-M7166.cs [^] (596 bytes) 08-27-08 21:43
 Speedup-AllSelectors-M7166.1.cs [^] (909 bytes) 09-28-08 16:26

- Relationships
child of 0007423new  Fixes included in Level Playing Field 

- Notes
(0012533 - 88 - 120 - 120 - 120 - 120 - 120)
Keith_Hodges
08-27-08 21:44

"fix begin"
Installer mantis bug: 7166 fix: 'Speedup-AllSelectors-M7166.cs'.
"fix end"
 
(0012702 - 141 - 141 - 141 - 141 - 141 - 141)
Damien Cassou
09-28-08 14:01

I've sent that fix to PharoInbox. I replaced 'withAllSuperclasses do:' by 'withAllSuperclassDo:' to avoid the creation of another collection.
 
(0012703 - 283 - 343 - 343 - 343 - 343 - 343)
Damien Cassou
09-28-08 14:47

I also added the following test:

testAllSelectors
  self assert: ProtoObject allSelectors = ProtoObject selectors.
  self assert: Object allSelectors = (Object selectors union: ProtoObject selectors).
  self assert: (Object allSelectorsBelow: ProtoObject) = (Object selectors).
 
(0012704 - 90 - 122 - 122 - 122 - 122 - 122)
Damien Cassou
09-28-08 16:26

"fix begin"
Installer mantis bug: 7166 fix: 'Speedup-AllSelectors-M7166.1.cs'.
"fix end"
 
(0013414 - 603 - 876 - 876 - 876 - 876 - 876)
nicolas cellier
11-29-09 20:27

In trunk, this doesn't make much difference as long as selectors are Array.
This version is even slightly faster than allSelectorsBelow:

Behavior>>allSelectors
    "Answer all selectors understood by instances of the receiver"

    ^(Array streamContents: [:strm |
        self withAllSuperclassesDo:
            [:aClass | strm nextPutAll: aClass selectors]]) asIdentitySet

{
[EToyProjectQueryMorph allSelectors] bench.
[EToyProjectQueryMorph allSelectorsBelow: nil] bench.
}
#('59.4691678307723 per second.' '53.64978061428 per second.')

Yes, we create intermediary collections, but cheap ones: Array...
 
(0013420 - 307 - 624 - 624 - 624 - 624 - 624)
leves
12-02-09 20:02

Even better without the intermediate collections:

Behavior >> allSelectors
    "Answer all selectors understood by instances of the receiver"

    ^(Array streamContents: [ :stream |
        self withAllSuperclassesDo: [ :aClass |
            aClass selectorsDo: [ :each |
                stream nextPut: each ] ] ]) asIdentitySet
 
(0013424 - 37 - 37 - 37 - 37 - 37 - 37)
leves
12-03-09 04:24

Added to the trunk with Kernel-ul.319
 

- Issue History
Date Modified Username Field Change
08-27-08 21:43 Keith_Hodges New Issue
08-27-08 21:43 Keith_Hodges File Added: Speedup-AllSelectors-M7166.cs
08-27-08 21:44 Keith_Hodges Note Added: 0012533
09-28-08 14:01 Damien Cassou Note Added: 0012702
09-28-08 14:47 Damien Cassou Note Added: 0012703
09-28-08 16:26 Damien Cassou File Added: Speedup-AllSelectors-M7166.1.cs
09-28-08 16:26 Damien Cassou Note Added: 0012704
12-16-08 17:48 Keith_Hodges Status new => confirmed
12-16-08 17:48 Keith_Hodges Fixed in Version  => 3.10.2bc
01-09-09 23:31 Keith_Hodges Status confirmed => resolved
11-28-09 02:25 matthewf Relationship added child of 0007423
11-29-09 20:27 nicolas cellier Note Added: 0013414
12-02-09 20:02 leves Note Added: 0013420
12-03-09 04:24 leves Note Added: 0013424
04-18-10 21:59 andreas Status resolved => closed


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
73 total queries executed.
47 unique queries executed.
Powered by Mantis Bugtracker