commit: [] cost

Chris Muller afunkyobject at yahoo.com
Thu Nov 2 05:18:05 UTC 2006


Great question.  Generally, it is faster to make the commits "chunkier", i.e., put the commit on the outside:

session commit: [
   collection do: [:each | each doSomething]]

but of course you have to be careful about committing *too much* at once.  Magma imposes a (ridiculous) 10-meg limit, but you would never want to get close to that much in one commit, and with larger commits you have higher potential for concurrency with
other users. but I assume this question is purely in context of single-user, raw
performance.

To help answer where to balance, it helps to know know how fast Magma can "oscillate" given a minimum commit (1 object change).  As it happens, this is one of the very benchmarks of MagmaBenchmarker which you get for loading MagmaTesterLoader.  You can run it or see http://minnow.cc.gatech.edu/squeak/5606 to see results from my computer:
 writeTests
	peakCommitRate : 20.3430394894296 per second.
	oneThousandElementArrayCommit : 15.4977150804689 per second.
	a1001BufferCommit : 5.99640215870478 per second.
	aOneMillionBufferCommit : 18 seconds.peakCommitRate goes through all of Magma's apparatus to change one single object.  Since this is not especially quick, you want to do more than one object at a time, but you can see one million objects takes 18 second, probably too long.

The benchmarker also measures "reads", so you can optimize your ReadStrategy's to bring down large chunks, but not too large.

Regards,
  Chris




So the answer depends heavily on what doSomething is.  Generally, you want to do a "medium" amount of work in each commit.

----- Original Message ----
From: Hilaire Fernandes <hilaire2006 at laposte.net>
To: magma at lists.squeakfoundation.org
Sent: Wednesday, November 1, 2006 12:33:42 AM
Subject: commit: [] cost

Is the cost the same in these two code snippets?


session commit: [
   collection do: [:each | each doSomething]]



collection do: [:each |
   session commit: [each doSomething]]

Hilaire

_______________________________________________
Magma mailing list
Magma at lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/magma






More information about the Magma mailing list