Hi Denis, On Fri, Dec 18, 2015 at 9:36 AM, Denis Kudriashov <[email protected]> wrote:
> Hi. > > I found case where Spur more slow than Cog. Not much but. > Well, it might be indicative of a soluble problem. One thing that Spur is slower at is primitive failure; it catches primitive failure in the VM as potentially caused by primitives encountering forwarders. So many primitive failure involves a slow scan of the primitives arguments to some depth to find out if there are any forwarders which should be followed, and if so the primitive retried. So that means some idioms that use primitive failure normally will go slower. One of these is instVarAt: which used to be written instVarAt: index "Primitive. Answer a fixed variable in an object. The numbering of the variables corresponds to the named instance variables. Fail if the index is not an Integer or is not the index of a fixed variable. Essential. See Object documentation whatIsAPrimitive." <primitive: 73> "Access beyond fixed variables." ^self basicAt: index - self class instSize and used in some copying code to access indexable fields. Chris Muller found this in some of his Magma code and so we added a pair of new primitives, primitiveSlotAt and primitiveSlotAtPut that access any slot within the sequence of named followed by indexable inst vars, avoiding the primitive failure. So in Squeak Spur instVarAt: now reads: instVarAt: index "Primitive. Answer a fixed variable in an object. The numbering of the variables corresponds to the named instance variables, followed by the indexed instance variables. Fail if the index is not an Integer or is not the index of a fixed variable. Essential. See Object documentation whatIsAPrimitive." <primitive: 173 error: ec> self primitiveFailed I suspect something like this is happening with the veryDeepCopy code. You might want to use the profiler on both versions and compare. You might find an issue. HTH > prototype := BorderedMorph new. > > result := [prototype veryDeepCopy ] benchFor: 2 seconds. > > In my computer I got: > > Cog: a BenchmarkResult(16,982 iterations in 2 seconds 1 millisecond. 8,487 > per second) > Spur: a BenchmarkResult(12,507 iterations in 2 seconds 33 milliseconds. > 6,152 per second). > > Is it expected behavior for such case? > -- _,,,^..^,,,_ best, Eliot
