[squeak-dev] Re: CurrentReadOnlySourceFiles annoys me ...

Levente Uzonyi leves at caesar.elte.hu
Sat Dec 19 21:47:51 UTC 2015


On Sat, 19 Dec 2015, Eliot Miranda wrote:

> 
> 
> On Sat, Dec 19, 2015 at 12:51 PM, Levente Uzonyi <leves at caesar.elte.hu> wrote:
>       Hi Eliot,
>
>       I don't see how it would be any better than the current solution.
> 
> 
> Here's why.  Right now I have to type
> 
>  CurrentReadOnlySourceFiles cacheDuring: [self systemNavigation browseAllSelect: [:m| m getSourceFromFile includesSubString: 'foo']]
> 
> instead of
> 
>         self systemNavigation browseAllSelect: [:m| m getSourceFromFile includesSubString: 'foo']

No, you don't have to. Caching is totally optional. But if you don't use 
it, a new FileStream  will be created for every single method your code 
will read.

[ CurrentReadOnlySourceFiles cacheDuring: [self systemNavigation 
browseAllSelect: [:m| m getSourceFromFile asString includesSubString: 
'foo']] ] timeToRun. "==> 880"

[ self systemNavigation browseAllSelect: [:m| m getSourceFromFile asString 
includesSubString: 'foo'] ] timeToRun. "==> 4380"

> 
> which, frankly, is absurd.  We're penalising the common case.  If we provide a single read-only source file by default and have the uncommon case work around it, the common case, my daily life, is much easier.
> 
>
>       Currently users get correct behavior no matter what they do, and get good performance if they add some extra code (CurrentReadOnlySourceFiles cacheDuring: [ ... ]).
>       With your suggestion, users would have to add some extra code to get correct behavior.
> 
> 
> So what if, instead, the source files become process-aware and answer the single file if the accessor is in "the current IDE process", such that the notion of what's the owning process is weak, and by default the source files are unowned?  This approach has a chance of
> solving the debugger issue too.

That was my last-resort suggestion a few mails earlier, but I still find 
using a ProcessLocalVariable superior to this, since that way all 
processes can have their own read-only copies. I'm not sure how well the 
debugger can work with PLVs though.

Levente

>  
> 
>
>       Levente
>
>       On Fri, 18 Dec 2015, Eliot Miranda wrote:
>
>             Hi Levente,
>             On Fri, Dec 18, 2015 at 4:05 PM, Levente Uzonyi <leves at caesar.elte.hu> wrote:
>                   Hi Eliot,
>
>                   I don't remember the exact case which made the Pharo guys do this change, but if you implement a web service, which shows source code on a web page, and reads the code from the image, then a non-UI process will read the source code from
>             SourceFiles, which
>                   can lead to the problems I've described. IIRC Seaside has such example service.
> 
>
>             For this I'd be tempted to implement something like withClonedReadOnlySourceFilesDuring: that installs a new read-only copy for the extent of a block, sort of analogous to deferred UI actions.  The requirement would be that any accessor of
>             source outside of normal user
>             (IDE) priority would use it.  What do you think, worse than the disease, or acceptable?
>              
> 
>
>                   Levente
>
>                   On Wed, 16 Dec 2015, Eliot Miranda wrote:
>
>                         Hi Levente,
>                         On Wed, Dec 16, 2015 at 2:43 PM, Levente Uzonyi <leves at caesar.elte.hu> wrote:
>                               My objection is that concurrent access of the read-only source files would cause race conditions.
>                               We might simplify the thing by using the regular source files (or some shared read-only copies) when requested from the UI process, and create a read-only copy for all other processes. That would cover most potential slow-downs
>             in the
>                         Trunk.
> 
>
>                         Apart form the debugger can you think of situations in which this will really happen?  I can't. If you can convince me that concurrent access is a real danger then I'll think again, but in all my time doing Smalltalk with
>             Smalltalk-80 v2, with
>                         VisualWorks and with
>                         Croquet, Squeak and Pharo the only time this has been an issue was in the debugger debugging source file access.  Given that that's easy to solve I don't see the point of living with such slow source file access for any longer :-)
>
>                          
> 
>
>                               Levente
>
>                               On Wed, 16 Dec 2015, Eliot Miranda wrote:
>
>                                     Hi all,
>
>                                        IMO we don't need CurrentReadOnkySourceFiles, instead we should have SourceFilesArray maintain one read-only copy per source file.  The objection is that using a single file will make debugging source file access
>             break, since the
>                         debuggers
>                                     own access to source will perturb the source files whose access is being debugged, but the debugger can easily temporarily install a different read-init copy whenever it accesses source, insulating the debugged code from
>             this effect.
>
>                                     _,,,^..^,,,_ (phone)
>
>                                           On Dec 16, 2015, at 4:38 AM, marcel.taeumel <Marcel.Taeumel at hpi.de> wrote:
>
>                                           I want to catch all exceptions because it is kind of test code where only
>                                           success matters. :-)  It is an experiment where the participants should
>                                           program stuff and receive a green tick whenever the task is accomplished.
>                                           Raising a debugger when the participant puts a "self halt" or anything into
>                                           the control flow of the test code would confuse the participant.
>
>                                           Conceptionally, CurrentReadOnlySourceFiles is no kind of an exception. Thank
>                                           you for the explanation. Can you sketch the steps to transform that into a
>                                           PLV? Why would it take some effort?
>
>                                           Bset,
>                                           Marcel
> 
> 
>
>                                           --
>                                           View this message in context: http://forum.world.st/CurrentReadOnlySourceFiles-annoys-me-tp4867253p4867327.html
>                                           Sent from the Squeak - Dev mailing list archive at Nabble.com.
> 
> 
> 
> 
> 
> 
>
>                         --
>                         _,,,^..^,,,_
>                         best, Eliot
> 
> 
> 
> 
> 
> 
>
>             --
>             _,,,^..^,,,_
>             best, Eliot
> 
> 
> 
> 
> 
> 
> 
> --
> _,,,^..^,,,_
> best, Eliot
> 
>


More information about the Squeak-dev mailing list