[squeak-dev] The Trunk: Files-eem.195.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Jul 14 04:09:37 UTC 2022


Eliot Miranda uploaded a new version of Files to project The Trunk:
http://source.squeak.org/trunk/Files-eem.195.mcz

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

Name: Files-eem.195
Author: eem
Time: 13 July 2022, 9:09:36.427827 pm
UUID: 7ccbfb5c-e5d3-4911-9497-09fdc484d09c
Ancestors: Files-eem.194

Occasionally FileDirectory>>exists fails.  The old implementation seems unreliable, but it's also slow.  So if possible, implement it above primLookupEntryIn:name:


Old:
| foo bar baz |
foo := FileDirectory on: '/no/where/at/all'.
bar := FileDirectory on: '/Users/eliot/Desktop/not there'.
baz := FileDirectory default.
[foo exists. bar exists. baz exists] bench '8,070 per second. 124 microseconds per run. 0 % GC time.' 

New:
| foo bar baz |
foo := FileDirectory on: '/no/where/at/all'.
bar := FileDirectory on: '/Users/eliot/Desktop/not there'.
baz := FileDirectory default.
[foo exists. bar exists. baz exists] bench '73,700 per second. 13.6 microseconds per run. 0.64 % GC time.'

=============== Diff against Files-eem.194 ===============

Item was changed:
  ----- Method: FileDirectory>>exists (in category 'testing') -----
  exists
+ 	"Answer whether the directory exists"
+ 	^self class currentDirectoryNickname
+ 		ifNotNil:
+ 			[:me|
+ 			(self primLookupEntryIn: pathName asVmPathName name: me asVmPathName)
+ 				ifNil: [false]
+ 				ifNotNil: [:maybeErr| maybeErr ~~ #primFailed]]
+ 		ifNil:
+ 			[(self primLookupEntryIn: pathName asVmPathName index: 1) ~~ #badDirectoryPath]!
- "Answer whether the directory exists"
- 
- 	| result |
- 	result := self primLookupEntryIn: pathName asVmPathName index: 1.
- 	^ result ~= #badDirectoryPath
- !



More information about the Squeak-dev mailing list