Nick Green wrote:
> I have this piece of code:
> 
> start = Time.now.to_i
> entity.save
> puts "Saving one item took #{Time.now.to_i-start} seconds"
> 
> ... it outputs
> 
> Saving one item took 7 seconds.

Try saving two entities one after the other, and time each of them. 
Maybe it's a startup overhead.

Startup problems could be:

- loading in the ActiveRecord and ActiveSupport libraries (although I 
guess in your case they are already loaded)

- slowness establishing a connection to your database, such as lack of 
reverse DNS (e.g. server accepts connection, tries to resolve your IP 
into a name for logging purposes, times out, continues)

If it's the latter problem, on the server try adding your client's IP 
address and name into /etc/hosts

> I think this must be something I don't understand about activerecord
> itself.

Detailled questions specific to ActiveRecord would be best asked on a 
Rails mailing list, since AR is a component of Rails.
-- 
Posted via http://www.ruby-forum.com/.