On Sunday, September 6, 2020 at 7:42:23 AM UTC-7, Janko Marohnić wrote:
>
> I'm preparing a presentation on Sequel, and I wanted to show some 
> benchmarks comparing Sequel performance to Active Record.
>
> First off, to equalize the fact that Active Record typecasts column values 
> on-the-fly when the column reader is called, in my benchmark I'm calling 
> all column readers after fetching the records from the database.
>
> However, I noticed that Active Record's PostgreSQL & SQLite adapters both 
> seem to use the underlying client gem (pg & sqlite3) to convert timestamps, 
> while Sequel converts timestamps itself via 
> Database#to_application_timestamp. On CRuby, Time.parse is quite slow, and 
> it usually dominates my benchmarks. For Postgres adapter everything is fine 
> when I use sequel_pg, though.
>
> I'm curious whether there is a possibility for Sequel's PostgreSQL & 
> SQLite adapters to let the pg/sqlite3 gems to convert the timestamps into 
> Time objects. I know that at least replicating the timezone handling could 
> be tricky. But this could improve performance significantly when fetching 
> records with lots of timestamps. Since most Ruby developers prefer 
> Postgres, it would also mean that Sequel's postgres adapter would be faster 
> out-of-the-box (for folks that haven't yet discovered sequel_pg).
>

I would definitely consider a pull request that uses the driver method if 
possible, as long as it passes all tests and improves performance.  It's 
possible you could use this approach if a database/application timestamp 
was not set, but I'm not sure you could get correct behavior if a 
database/application timestamp was set using this approach.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/27a0e0e1-05f9-4ec6-a39b-5197b2c67915o%40googlegroups.com.

Reply via email to