Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0007172 [Squeak] Collections minor always 08-31-08 12:48 04-18-10 22:05
Reporter nicolas cellier View Status public  
Assigned To nicolas cellier
Priority normal Resolution fixed  
Status closed   Product Version 3.10
Summary 0007172: CharacterSetComplement byteArrayMap optimization is slow
Description CharacterSetComplement has been introduced to handle compatibility of CharacterSet with WideCharacters (charCode > 255).

They are homo-morphic with CharacterSet and can be used in place of regular CharacterSet.

However, one optimized feature of CharacterSet, using their byteArrayMap, is completely spoiled regarding efficiency for CharacterSetComplement. An example of this is illustrated using Andreas Raab nextFloat from 0006976 , a slow down up to 10x can be observed because byteArrayMap is computed in tight loops.
If ever String initialization has not been correctly done after installing CharacterSetComplement, this slow down will be observed after a (String initialize).

Try
  MessageTally spyOn: [10000 timesRepeat: ['0.0' readStream nextFloat]].

This feature is not often used, but since used in places where speed matters (maybe tight loops), it is better to restore efficiency using a cache. Things that were reasonably optimized in old images shouldn't be spoiled by new changes. I will provide a patch.
Additional Information
Attached Files  CharacterSetComplement-byteArrayMap-speedUp-M7172-nice.1.cs [^] (2,269 bytes) 08-31-08 13:00

- Relationships

- Notes
(0012557 - 1809 - 2345 - 2345 - 2425 - 2425 - 2425)
nicolas cellier
08-31-08 13:12

Using 0006976 test in 3.9 image and 3.10 images:


{Float pi printString.
'0.0'.
'0.0001'.
'1.2000000'.
'3.14159'.
'-3.14159'.
'314159.276'.
'3.14159e10'.
'3.14159e-10'.
'NaN'.
'-Infinity'.
20 factorial printString.
} collect: [:e | e->
    {Time millisecondsToRun: [10000 timesRepeat: [e readStream nextFloat]].
    Time millisecondsToRun: [10000 timesRepeat: [SqNumberParser parse: e readStream]].
    Time millisecondsToRun: [10000 timesRepeat: [Number readFrom: e readStream]].}].

BEFORE PATCH:
{'3.141592653589793'->#(2485 2821 2357) .
'0.0'->#(1389 545 628) .
'0.0001'->#(1403 838 803) .
'1.2000000'->#(1423 1018 988) .
'3.14159'->#(1408 932 877) .
'-3.14159'->#(1411 952 868) .
'314159.276'->#(1423 1114 1048) .
'3.14159e10'->#(1510 1418 1572) .
'3.14159e-10'->#(1528 1541 2219) .
'NaN'->#(1387 130 99) .
'-Infinity'->#(1431 245 214) .
'2432902008176640000'->#(2500 2147 2116)}

AFTER PATCH:
{'3.141592653589793'->#(1326 3228 2746) .
'0.0'->#(104 559 642) .
'0.0001'->#(127 895 863) .
'1.2000000'->#(150 1152 1132) .
'3.14159'->#(134 1069 933) .
'-3.14159'->#(135 1006 923) .
'314159.276'->#(150 1194 1123) .
'3.14159e10'->#(244 1454 1608) .
'3.14159e-10'->#(262 1752 2486) .
'NaN'->#(109 135 123) .
'-Infinity'->#(147 264 228) .
'2432902008176640000'->#(1239 2346 2309)}

After patch and various SqNumberParser speed up (Number readFrom: using SqNumberParser in this image)
 {'3.141592653589793'->#(1138 1623 1626) .
'0.0'->#(96 263 267) .
'0.0001'->#(121 480 479) .
'1.2000000'->#(142 470 476) .
'3.14159'->#(130 499 500) .
'-3.14159'->#(129 505 510) .
'314159.276'->#(146 532 531) .
'3.14159e10'->#(231 504 507) .
'3.14159e-10'->#(250 894 898) .
'NaN'->#(103 235 241) .
'-Infinity'->#(137 262 273) .
'2432902008176640000'->#(1118 578 648)}
 
(0013207 - 129 - 177 - 177 - 177 - 177 - 177)
nicolas cellier
07-19-09 20:22

"fix begin"
Installer mantis bug: 7172 fix:'CharacterSetComplement-byteArrayMap-speedUp-M7172-nice.1.cs'.
"fix test"
"fix end"
 
(0013268 - 64 - 64 - 224 - 224 - 224 - 224)
nicolas cellier
08-24-09 20:06

Fixed in http://source.squeak.org/trunk/Collections-nice.111.mcz [^]
 

- Issue History
Date Modified Username Field Change
08-31-08 12:48 nicolas cellier New Issue
08-31-08 13:00 nicolas cellier File Added: CharacterSetComplement-byteArrayMap-speedUp-M7172-nice.1.cs
08-31-08 13:12 nicolas cellier Note Added: 0012557
07-19-09 20:22 nicolas cellier Note Added: 0013207
08-24-09 20:06 nicolas cellier Note Added: 0013268
09-03-09 21:15 nicolas cellier Status new => resolved
09-03-09 21:15 nicolas cellier Fixed in Version  => trunk
09-03-09 21:15 nicolas cellier Resolution open => fixed
09-03-09 21:15 nicolas cellier Assigned To  => nicolas cellier
04-18-10 22:05 andreas Status resolved => closed


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