Magma with style

Igor Stasenko siguctua at gmail.com
Fri Dec 10 09:17:33 UTC 2010


On 10 December 2010 00:47, Facundo Vozzi <facundov79 at gmail.com> wrote:
> Now I'm getting a performance problem.
> I'm bulk loading transactions in sets (from a file) of 1250. Each of one has
> references to 3 objects, 3 numbers and 2 dates.
> When I test it without setting the customer it take to me 614 milliseconds
> to create the 1250 instances but if I look up for each client according to
> the client code it take to me 204158 milliseconds (3.40 minutes).
> Customers is a MagmaCollection and this is the method of the message that
> I'm sending 1250 times:
> customerAtDocumentNumber: unString sex: otroString
> "Devuelve un invividuo o una organizacion dependiendo de si unString
> corresponde a un número de documento o a un número de cuit. NOTA: se debe
> tener en cuenta el sexo por existir números de dni repetidos entre varones y
> mujeres."
> | aFewCustomers |
> aFewCustomers := self customers where: [ :each | (each documentNumber =
> unString)].
> ^customers detect: [:each | each documentNumber = unString and: [each sex =
> otroString]] ifNone: []
>
>
> Customers has an index on documentNumber. Now I go to profile it but I need
> to find how to do it in Pharo.
> I thing that I can switch customers from MagmaCollection to MagmaDictionary
> and set the document number + sex how the key. What do you think?

So, why you don't simply add a 'customer' ivar to document
and to access it, you then just need to say:

document customer

instead of looking it up using index?

1:1 relation is a reference. Think simple :)

> See you,
> Facu
>




-- 
Best regards,
Igor Stasenko AKA sig.


More information about the Magma mailing list