My completely empty model (no validation callbacks etc etc) takes an
average of 0.05 seconds to create, at least according to
Benchmark.realtime{200.times{Message.create(:from =>
“[email protected]”, :message_type => ‘email’,
:subject => “hello”, :body => “goodbye”, :sent_at => Time.now)}}/200
That’s a little slower than I’m comfortable with for our needs. Is
there anything I can do to improve this?
I’m running Edge Rails, mysql 4.1 on FedoraCore 4 with a 3GHz Pentium 4.
Jon
Jonathan del Strother wrote:
I’m running Edge Rails, mysql 4.1 on FedoraCore 4 with a 3GHz Pentium 4.
Jon
Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails
If you are really going to create a lot of records right next to each
other put the whole set in a transaction.
–
Jack C.
[email protected]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jack C. wrote:
That’s a little slower than I’m comfortable with for our needs. Is
If you are really going to create a lot of records right next to each
other put the whole set in a transaction.
If you are worried about the speed of many creations, check out:
http://blogs.mktec.com/zdennis/articles/2006/07/15/activerecord-optimizations-0-0-1
http://blogs.mktec.com/zdennis/articles/2006/07/20/activerecord-optimizations-0-0-2
http://blogs.mktec.com/zdennis/articles/2006/08/03/activerecord-optimizations-er-extensions-0-0-3\
It is a way to do multivalue inserts in an optimized fashion for MySQL,
based on the max number of allowed packets that the server allows.
If you are just worried about the creation of a single record then you
may want to determine what your validations are (if any) and if you want
to save_without_validation which will bypass some of the callbacks.
If any questions or comments feel free to let me know.
Zach
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFE3ItdMyx0fW1d8G0RArKQAJ9SI6cYoPQJSDIYxsGxiE1B25ggJwCeNWWg
8aWvv6otr1IHHD5dmzXv9J0=
=OB9g
-----END PGP SIGNATURE-----
On 11 Aug 2006, at 03:49, Jack C. wrote:
That’s a little slower than I’m comfortable with for our needs.
http://lists.rubyonrails.org/mailman/listinfo/rails
If you are really going to create a lot of records right next to
each other put the whole set in a transaction.
Unfortunately, I can’t. I’m only receiving 1 new message on each
incoming request.